Why do s clear floats?

Apparently <fieldset> elements are supposed to generate block formatting contexts for their contents: The fieldset element is expected to establish a new block formatting context. That’s why floated elements don’t float out of them. I would guess that this has to do with the nature of fieldsets as visual form control groups. There could be … Read more

How can I make a fieldset legend-style “background line” on heading text?

See: http://jsfiddle.net/thirtydot/jm4VQ/ If the text needs to wrap, this won’t work. In IE7, there will be no line. HTML: <h2><span>Centered Header Text</span></h2> CSS: h2 { text-align: center; display: table; width: 100%; } h2 > span, h2:before, h2:after { display: table-cell; } h2:before, h2:after { background: url(http://dummyimage.com/2×1/f0f/fff&text=+) repeat-x center; width: 50%; content: ‘ ‘; } h2 … Read more