By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,977 Members | 1,352 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,977 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.