tags:

views:

139

answers:

3

In ASCII Art, I want something similar to the following:

My Section ------------------------------

It's just that I'd like that line to be done in CSS to fill the space automatically. I don't want them to actually be hyphens. I just want a visual line.

+1  A: 
<html>
  <div style='float:left'>My Section</div>
  <hr>
</html>

If you'd like the line centered vertically to the text, you could do this:

<html>
  <div style='float:left'>Hello &nbsp;</div>
  <hr style='position:relative;top:8px'>
</html>
Andrew Johnson
+2  A: 

Something like this?

<h1 style="background-image:url(../images/middleline.jpg);"><span style="background-color:white;">My text</span></h1>

EDIT:

Also see this question.

Joel Potter
Should add positioning elements for the background image based on ems (.5em, or a touch less to accommodate width of the line), so that it stays vertically centered regardless of how big the text gets.
anschauung
Why ems? Just use background-position:center;background-repeat:repeat-x; and it should stay centered.
Joel Potter
Why in the heck would you use an image for this. Just use an <HR> tag.
Andrew Johnson
An hr is harder to center. Possible, yes, but you're going to get more wonkyness in display.
Joel Potter
A: 

here's a quick solution: make a span with width: 100% that's in the place where you want it and then set the border-bottom: 1px black solid;

CrazyJugglerDrummer