Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] CSS Trick for a horizontal type line behind text Re: CSS Trick for a horizontal type line behind text

#132484
_bmd
Member

I built from Eric’s model and cleaned it up a bit so that no background color is needed. I did have to keep the span, though.
http://jsfiddle.net/_bmd/PB5v2/

The trick with my solution is that you’ll have to manually adjust the margins for the line (it’s pushed from opposite interior box walls). If you’re coding each page manually, that shouldn’t really be a problem, as you can get pretty close within 3 guesses.
If you’re trying to build a page that can populate data automatically, then I’d suggest you query for the length of the data, then set something like 0.5*length “em” to the margins. Obviously, YMMV, and you’ll probably have to do some tinkering to get it perfect.