Getting LEGEND tags to wrap text properly.

Posted by DA on Stack Overflow See other posts from Stack Overflow or by DA
Published on 2010-03-25T20:02:18Z Indexed on 2010/03/25 20:03 UTC
Read the original article Hit count: 488

Filed under:
|

Legend tags are always a nuisance as they don't adhere to a lot of CSS rules.

I'm trying to get the text within a LEGEND tag to wrap using the typical solution of wrapping the text in the LEGEND with a span and setting the width and display: block.

 <legend>
    <span style="border: 1px solid blue; width: 250px; display: block">
        This text should wrap if it gets longer than 250px in width
    </span>
 </legend>

I thought this used to work In Firefox, but does not appear to work anymore in 3.6. Sample:

http://jsbin.com/exeno/5

It still works in IE.

Has anyone found a fix for this or is it just a matter of forgoing LEGEND tags and go back to H# tags?

© Stack Overflow or respective owner

Related posts about legend

Related posts about css