[whatwg] Proposal: Allow block content inside label element
mart at degeneration.co.uk
Tue May 8 12:10:37 PDT 2007
Brad Fults wrote:
> Currently, as far as I can tell, in HTML 4  and HTML 5 , the
> label element is defined as having inline content. When using the
> implicit form control association pattern described in the HTML 4 spec
> (e.g. a form control inside of the label element instead of or in
> addition to using the |for| attribute), this becomes a problem.
> Specifically, if one tries to place a textarea element inside of a
> label element, modern browsers will insert the textarea as a later
> sibling to the label in the DOM instead of as a child. This seems to
> be due to the fact that the textarea is a block element and that label
> can't contain it according to the spec.
Some software that I'm responsible for frequently wraps <label> elements
around <div> elements, purely because current versions of IE will not
apply display:inline-block to inline elements. While I guess that is
using a deviation from the HTML spec in order to compensate for a
deviation from the CSS spec, it's still something I'm not going to be
able to stop doing without a large amount of work.
For this reason, I certainly wouldn't mind label allowing block-level
children. Both Opera 9 and IE6 (the only browsers I have handy to test
right now) already support DIV as a child of LABEL correctly, per
Hixie's DOM viewer.
 A part of the CSS spec that Microsoft pioneered, but still...
More information about the whatwg