Reader Lindsey observes that the "
<span>" tag can be made to behave as a block-level element by adding a "
display: block;" property to the style definition applied to the span. This works fine in Firefox, Opera, and Internet Explorer. Declaring the span to be a block-level element also causes the background to fill the box instead of appearing ragged right. I have added an example of such a declaration to the example document. Still, as Lindsey notes, it's better to apply the background style to an enclosing container which is a block-level element to begin with instead of forcing the browser to change the interpretation of an inline element to behave as a block. (2006-06-26 12:24 UTC)
All these years, and I still haven't gotten tired of CSS. You know how sometimes you make a decision and you know it was the right one because other, seemingly unrelated things fall into place? That's what I dig so much about CSS -- when you're doing it right, if one component is well-written, other things can't help but be well-written too. I suppose that it becomes this way with anything, once you get good enough at it -- but I wouldn't know.