468,284 Members | 1,505 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,284 developers. It's quick & easy.

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

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.
Nov 19 '05 #1
3 3518
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)
"Josef K." <jo****@spamcastle.org> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
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.

Nov 19 '05 #2
Gazing into my crystal ball I observed "Josef K." <jo****@spamcastle.org>
writing in news:#2**************@tk2msftngp13.phx.gbl:
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" />
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.

<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?
You cannot nest a block level element inside of an inline element. Label
is an inline element, DIV is block level.
Could I replace the <span>...</span> with a
<div>...</div> ?


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.w3.org/TR/html4/index/elements.html
http://www.w3.org/TR/html4/index/attributes.html

--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Nov 19 '05 #3
Thanks for the explanation and links (and the advisory about the standards
issues).
K
Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by localhost | last post: by
2 posts views Thread by Daves | last post: by
reply views Thread by CharlesA | last post: by
2 posts views Thread by Richard Maher | last post: by
nathj
5 posts views Thread by nathj | last post: by
Dormilich
3 posts views Thread by Dormilich | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.