473,224 Members | 1,484 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

<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 3769
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: TR | last post by:
Is it possible with CSS to prevent this wrapping alignment with a checkbox with a nested label? This is the label of the checkbox that wraps beneath it I'd prefer it looked like...
8
by: localhost | last post by:
I would like to wrap all of the HTML inside of my <body> tag inside a <div> with in my code-behind. I do not want to touch the .aspx page template at all. I know how to make the body tag...
2
by: Daves | last post by:
I find this odd; to create a DIV (html) element I use the HTMLGeneric control; <div ID="myDiv" runat=server ... This has no .Text property such as myDiv.Text = "testing"; So I am forced to...
0
by: ValK | last post by:
Hello All! I have a scrolable <div> on my aspx page. <div class="PropertiesBody" id="divInput" style="OVERFLOW-Y: scroll; Z-INDEX: 108; LEFT: 40px; WIDTH: 616px; POSITION: absolute; TOP: 152px;...
0
by: CharlesA | last post by:
Hi folks, I'm using ASP.net 1.1 with C# I've got this kind of thing going <div class="row"> <label class="col1">Rm Name</label> <asp:textbox id="txtRM" runat="server" cssclass="col2"...
2
by: Richard Maher | last post by:
Hi, I'm trying to use the Visibility Style attribute for a Div to effectively PopUp a lightweight window with some additional context-sensitive information, when a user mouses over a given...
2
by: ShankerNair | last post by:
Howdy all, I would like to manipulate an HTML tag - a <div>, using ASP.NET, C# is the code behind. The tag would look something like this - <div id="divLime" style="visiblity:hidden"> ...
5
nathj
by: nathj | last post by:
Hi All, I'm working on a new site that has a two column layout underneath a title bar. If you check out: http://www.christianleadership.org.uk/scratch/mainpage.php using IE or Opera you will...
3
Dormilich
by: Dormilich | last post by:
Hi, I just have one thing about the label element, where I’m not certain. <label> is commonly used to attach visual/text information to a form control. so far, so good. <!-- just to make it...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.