I added the border only so we can see the size of the label. In this example, all three parts (XYZ, the input field, the add'l hint) are laid out in one line making the label field significantly longer than 5em. However, if I add either display: block; or float: left;, it suddenly obeys they width rule and adds line breaks to put the parts in three different lines.Code:<html> <head> <style> label { width: 5em; border: 1px dotted; } </style> </head> <body> <form> <label for="xyz"> XYZ: <input id="xyz" type="text" size="20">(additional hint) </label> </form> </body> </html>
I'd expect that even in the default (display: inline; or no display rule as above) it breaks lines when it reaches the width limit. Why does it not do that?
And anyway, does that display or float rule not apply to how the label shows in it's containing element (form or fieldset)? Why would it affect the stuff INSIDE the label, since float is not inheritable?
Confused...
Submit Your Article
Forum Rules

Reply With Quote
