Hello,
Quite a typical case of useless <span> I'm sure:
Code:<p class="block"> Some text </p>The whole width of the <p> is underlined, not just the string it contains. How can I avoid <span>s?Code:.block { border-bottom: 3px solid white; }
![]()
| SitePoint Sponsor |

Hello,
Quite a typical case of useless <span> I'm sure:
Code:<p class="block"> Some text </p>The whole width of the <p> is underlined, not just the string it contains. How can I avoid <span>s?Code:.block { border-bottom: 3px solid white; }
![]()

The easiest and most semantic way to underline text is to use text-decoration with a set font color as using <span> elements is quite redundant.
Blog/Portfolio | Evolution Xtreme | DFG Design | DFG Hosting | CSS-Tricks | Stack Overflow | Paul Irish
Having lame problems with your code? Let us help by using a jsFiddle
Add display:inline to the block class.

But I want it to display as a block.

Any posts I write in Arial are on my mobile phone, so please excuse typos etc.
Any posts I write in Verdana are on a PC, so feel free to berate me mercilessly for any mistakes

Twitter-@Ryan_Reese09
http://www.ryanreese.us -Always looking for web design/development work


it really depends as to WHY you need this to be a block element.
if its because of giving explicit dimensions, display:inline-block ; might do what you want.
If you just simply want a line break this might suit your needs:
.block {
border-bottom: 3px solid white;
display:inline;
}
.block:after, .block:before{ content:"\D\A"; }
Brilliant ideas, elegant execution.
Graphic Design, Art Direction, Copywriting and Web Design.
Bookmarks