<label><div></div></label> allowed?

<label><div></div></label> allowed?

Post by Josef K » Sun, 22 May 2005 06:05:52


Asp.net generates the following html when producing RadioButton lists:


<td><input
id="RadioButtonList_3"
type="radio"
name="MyRadioButtonList"
value="644"
onclick="__doPostBack('SitesRadioButtonList_3','')"
language="javascript" />

<label for="SitesRadioButtonList_3">Central Division<span
class='sitedescription'>plains states including Texas</span></label>

</td>

My question is, is it well-formed HTML to nest a <div></div> inside the
<label></label> tag? Could I replace the <span>...</span> with a
<div>...</div> ?

Thanks
K.
 
 
 

<label><div></div></label> allowed?

Post by Bruce Bark » Sun, 22 May 2005 09:22:17

yes, the main difference is a div is a block element and a span is a inline
(unless you override the style).

-- bruce (sqlwork.com)

 
 
 

<label><div></div></label> allowed?

Post by Adrienn » Sun, 22 May 2005 13:45:00

Gazing into my crystal ball I observed "Josef K." < XXXX@XXXXX.COM >



There is no attribute language for the INPUT element. The language
attribute is valid only for the SCRIPT element. Further, the language
attribute is deprecated and should only read: <script
type="text/javascript"...>

If you are on the WWW, you also have to worry about users with javascript
disabled and make sure the form will post without it.


You cannot nest a block level element inside of an inline element. Label
is an inline element, DIV is block level.


No. Again, you cannot nest block level elements in inline elements. Span
is an inline element, so it CAN be nested inside another inline element,
like Label.

http://www.yqcomputer.com/
http://www.yqcomputer.com/

--
Adrienne Boswell
http://www.yqcomputer.com/
Please respond to the group so others can share
 
 
 

<label><div></div></label> allowed?

Post by Josef K » Mon, 23 May 2005 23:13:24

Thanks for the explanation and links (and the advisory about the standards
issues).
K