<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Using labels in a nice semantic fashion</title>
	<atom:link href="http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/</link>
	<description>Web development and Internet trends</description>
	<pubDate>Fri, 29 Aug 2008 23:49:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
		<item>
		<title>By: Teddy Zetterlund</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-151880</link>
		<dc:creator>Teddy Zetterlund</dc:creator>
		<pubDate>Wed, 28 Nov 2007 14:31:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-151880</guid>
		<description>&lt;code&gt;
&#60;label&#62;
        Name
        &#60;input id="user-name" type="text"&#62;
    &#60;/label&#62;
&lt;/code&gt;
Don't do this – it doesn't work well in screen readers, and it doesn't make much semantic sense either. Labels &lt;em&gt;describe&lt;/em&gt; forms, they don't contain them.</description>
		<content:encoded><![CDATA[<p><code><br />
&lt;label&gt;<br />
        Name<br />
        &lt;input id="user-name" type="text"&gt;<br />
    &lt;/label&gt;<br />
</code><br />
Don&#8217;t do this – it doesn&#8217;t work well in screen readers, and it doesn&#8217;t make much semantic sense either. Labels <em>describe</em> forms, they don&#8217;t contain them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-118582</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Tue, 09 Oct 2007 08:24:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-118582</guid>
		<description>Guilherme,

Always! :-)</description>
		<content:encoded><![CDATA[<p>Guilherme,</p>
<p>Always! <img src='http://www.robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guilherme Zuhlke O'Connor</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-118569</link>
		<dc:creator>Guilherme Zuhlke O'Connor</dc:creator>
		<pubDate>Tue, 09 Oct 2007 07:25:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-118569</guid>
		<description>Yes, I know. But one can dream, can't one? :-)</description>
		<content:encoded><![CDATA[<p>Yes, I know. But one can dream, can&#8217;t one? <img src='http://www.robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-117825</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Mon, 08 Oct 2007 07:56:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-117825</guid>
		<description>Guilherme,

That would be a nice way to do it. However, not an alternative in our toolbox: :-)</description>
		<content:encoded><![CDATA[<p>Guilherme,</p>
<p>That would be a nice way to do it. However, not an alternative in our toolbox: <img src='http://www.robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guilherme Zuhlke O'Connor</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-116775</link>
		<dc:creator>Guilherme Zuhlke O'Connor</dc:creator>
		<pubDate>Sun, 07 Oct 2007 00:43:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-116775</guid>
		<description>I totally agree, but I must say both methods seem a little weird to me.

The first one bothers me because the label is in fact an element of the form element and it is strange to have two separated things that must be connected, which happens in both ways (by the for attribute in the first, and by inclusion in the second)

I would really like if labels could be written like this:
&#60;input id="user-name" type="text" label="Name"&#62;

To me, seems natural that the label is a part of the form element as much as the id or the value, but not otherwise as the second mode suggests. Anyway, among the possible options, I certainly stick with the one you propose.</description>
		<content:encoded><![CDATA[<p>I totally agree, but I must say both methods seem a little weird to me.</p>
<p>The first one bothers me because the label is in fact an element of the form element and it is strange to have two separated things that must be connected, which happens in both ways (by the for attribute in the first, and by inclusion in the second)</p>
<p>I would really like if labels could be written like this:<br />
&lt;input id=&#8221;user-name&#8221; type=&#8221;text&#8221; label=&#8221;Name&#8221;&gt;</p>
<p>To me, seems natural that the label is a part of the form element as much as the id or the value, but not otherwise as the second mode suggests. Anyway, among the possible options, I certainly stick with the one you propose.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-115511</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Fri, 05 Oct 2007 10:51:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-115511</guid>
		<description>Andreas,

Absolutely, educating people is the key.</description>
		<content:encoded><![CDATA[<p>Andreas,</p>
<p>Absolutely, educating people is the key.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andreas</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-115441</link>
		<dc:creator>Andreas</dc:creator>
		<pubDate>Fri, 05 Oct 2007 09:26:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-115441</guid>
		<description>That's true, and at work neither do I, but on personal projects I don't really care about IE and always &lt;a href="http://exscale.se/archives/2007/08/27/encourage-ie-users-to-upgrade-to-a-modern-browser/" rel="nofollow"&gt;encourage IE users to upgrade to a modern browser&lt;/a&gt;.

I believe that if more people did that, less people would be using IE...</description>
		<content:encoded><![CDATA[<p>That&#8217;s true, and at work neither do I, but on personal projects I don&#8217;t really care about <acronym title="Internet Explorer">IE</acronym> and always <a href="http://exscale.se/archives/2007/08/27/encourage-ie-users-to-upgrade-to-a-modern-browser/" rel="nofollow">encourage <acronym title="Internet Explorer">IE</acronym> users to upgrade to a modern browser</a>.</p>
<p>I believe that if more people did that, less people would be using <acronym title="Internet Explorer">IE</acronym>&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-114323</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Wed, 03 Oct 2007 06:46:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-114323</guid>
		<description>Andreas,

Well, most of us don't have the luxuary to not support a web browser that has about 90% of the web browser market... :-)</description>
		<content:encoded><![CDATA[<p>Andreas,</p>
<p>Well, most of us don&#8217;t have the luxuary to not support a web browser that has about 90% of the web browser market&#8230; <img src='http://www.robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andreas</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-110540</link>
		<dc:creator>Andreas</dc:creator>
		<pubDate>Wed, 26 Sep 2007 12:57:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-110540</guid>
		<description>I always put the form-element inside the label because I think the extra id-attribute clutters the code.  
I don't understand why the for-attribute can't work with the (required) name-attribute of the form-element instead? That way you wouldn't need to mess up your code with unnecessary attributes.  
I stopped caring about IE years ago so not really bothered that it doesn't work there.</description>
		<content:encoded><![CDATA[<p>I always put the form-element inside the label because I think the extra id-attribute clutters the code.<br />
I don&#8217;t understand why the for-attribute can&#8217;t work with the (required) name-attribute of the form-element instead? That way you wouldn&#8217;t need to mess up your code with unnecessary attributes.<br />
I stopped caring about <acronym title="Internet Explorer">IE</acronym> years ago so not really bothered that it doesn&#8217;t work there.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-110147</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Tue, 25 Sep 2007 20:48:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-110147</guid>
		<description>Arjan,

That is a nice feature, but it's achieved with using a correct &lt;code&gt;for&lt;/code&gt; attribute, not necessarily having the, for example, checkbox within the &lt;code&gt;label&lt;/code&gt; element.</description>
		<content:encoded><![CDATA[<p>Arjan,</p>
<p>That is a nice feature, but it&#8217;s achieved with using a correct <code>for</code> attribute, not necessarily having the, for example, checkbox within the <code>label</code> element.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arjan Eising</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-110098</link>
		<dc:creator>Arjan Eising</dc:creator>
		<pubDate>Tue, 25 Sep 2007 19:48:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-110098</guid>
		<description>I agree with the point on the form field outside the &lt;code&gt;label&lt;/code&gt; element. But I think it might good to put the form field inside the &lt;code&gt;label&lt;/code&gt; element when it is a check box or radio box. In this way it is easier to click on those little buttons with their label.</description>
		<content:encoded><![CDATA[<p>I agree with the point on the form field outside the <code>label</code> element. But I think it might good to put the form field inside the <code>label</code> element when it is a check box or radio box. In this way it is easier to click on those little buttons with their label.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-109980</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Tue, 25 Sep 2007 15:05:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-109980</guid>
		<description>jbot,

Well, that is a way to use it. But I still think that it shouldn't include the form element within the &lt;code&gt;label&lt;/code&gt; element.</description>
		<content:encoded><![CDATA[<p>jbot,</p>
<p>Well, that is a way to use it. But I still think that it shouldn&#8217;t include the form element within the <code>label</code> element.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jbot</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-109960</link>
		<dc:creator>jbot</dc:creator>
		<pubDate>Tue, 25 Sep 2007 14:26:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-109960</guid>
		<description>If you want to use &lt;strong&gt;implicit labels&lt;/strong&gt;, but &lt;em&gt;accentuate&lt;/em&gt; which part is the label, then wrap the label text in a definition tag (&lt;code&gt;&lt;abbr title="definition tag"&gt;DFN&lt;/abbr&gt;&lt;/code&gt;), like so:
&lt;code&gt;
&#60;label for="comment"&#62;
    &#60; dfn&#62;Comment&#60;/dfn&#62;
    &#60;textarea name="user_comment" id="comment"&#62; &#60;/textarea&#62;
&#60;/label&#62;
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>If you want to use <strong>implicit labels</strong>, but <em>accentuate</em> which part is the label, then wrap the label text in a definition tag (<code><abbr title="definition tag">DFN</abbr></code>), like so:<br />
<code><br />
&lt;label for="comment"&gt;<br />
    &lt; dfn&gt;Comment&lt;/dfn&gt;<br />
    &lt;textarea name="user_comment" id="comment"&gt; &lt;/textarea&gt;<br />
&lt;/label&gt;<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-109804</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Tue, 25 Sep 2007 06:44:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-109804</guid>
		<description>Good to see that so many share my opinion!

Deborah,

Ah, good ol' mr. Featherstone. I guess I need to have a talk with him then! :-) But I don't think it's necessarily poor accessibility, it's more about semantic meaning and, to me, not exactly using the element as it was intended.

Nick Webb,

Partly, I agree with you; it is good to set up a connection, but usually the &lt;code&gt;for&lt;/code&gt; attribute is sufficient for this. But I don't think that a &lt;code&gt;label&lt;/code&gt; element is the solution. I'd rather say that we're missing a proper elements for this in the specification.

Jules,

Thanks! Fixed it.</description>
		<content:encoded><![CDATA[<p>Good to see that so many share my opinion!</p>
<p>Deborah,</p>
<p>Ah, good ol&#8217; mr. Featherstone. I guess I need to have a talk with him then! <img src='http://www.robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> But I don&#8217;t think it&#8217;s necessarily poor accessibility, it&#8217;s more about semantic meaning and, to me, not exactly using the element as it was intended.</p>
<p>Nick Webb,</p>
<p>Partly, I agree with you; it is good to set up a connection, but usually the <code>for</code> attribute is sufficient for this. But I don&#8217;t think that a <code>label</code> element is the solution. I&#8217;d rather say that we&#8217;re missing a proper elements for this in the specification.</p>
<p>Jules,</p>
<p>Thanks! Fixed it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven Clark</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-109633</link>
		<dc:creator>Steven Clark</dc:creator>
		<pubDate>Mon, 24 Sep 2007 21:51:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-109633</guid>
		<description>True, divitis by any other name is still divitis. Nice article Robert, I wasn't aware you could use label in this way. Thanks.</description>
		<content:encoded><![CDATA[<p>True, divitis by any other name is still divitis. Nice article Robert, I wasn&#8217;t aware you could use label in this way. Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Petr Urbancik</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-109497</link>
		<dc:creator>Petr Urbancik</dc:creator>
		<pubDate>Mon, 24 Sep 2007 17:06:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-109497</guid>
		<description>I vote for the "label-outside-formfield". I am used to take JS to improve accessibility of my forms and when you have the for argument, it is easier to handle the elements in DOM. In case of making compact forms (labels convert to a auto-hiding default value), the concept "form field within a label" is a problem.</description>
		<content:encoded><![CDATA[<p>I vote for the &#8220;label-outside-formfield&#8221;. I am used to take JS to improve accessibility of my forms and when you have the for argument, it is easier to handle the elements in <acronym title="Document Object Model">DOM</acronym>. In case of making compact forms (labels convert to a auto-hiding default value), the concept &#8220;form field within a label&#8221; is a problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roger Johansson</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-109496</link>
		<dc:creator>Roger Johansson</dc:creator>
		<pubDate>Mon, 24 Sep 2007 17:03:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-109496</guid>
		<description>Totally agreed. Form controls inside labels don't make sense.</description>
		<content:encoded><![CDATA[<p>Totally agreed. Form controls inside labels don&#8217;t make sense.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jules</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-109487</link>
		<dc:creator>Jules</dc:creator>
		<pubDate>Mon, 24 Sep 2007 16:42:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-109487</guid>
		<description>Robert: Just would like to first suggest a correction to your first example: you have user-&lt;strong&gt;m&lt;/strong&gt;ane and user-&lt;strong&gt;n&lt;/strong&gt;ame.

My preference is having the label element separate from the form control for CSS reasons. However, either way, I would use the for/id elements (matching properly of course, :-)) because without the for attribute, when you click on the label text, the option/control is not selected in IE whereas &lt;em&gt;with&lt;/em&gt; the for attribute, the option/control is selected when you click on the label text.</description>
		<content:encoded><![CDATA[<p>Robert: Just would like to first suggest a correction to your first example: you have user-<strong>m</strong>ane and user-<strong>n</strong>ame.</p>
<p>My preference is having the label element separate from the form control for <acronym title="Cascading Style Sheets">CSS</acronym> reasons. However, either way, I would use the for/id elements (matching properly of course, :-)) because without the for attribute, when you click on the label text, the option/control is not selected in <acronym title="Internet Explorer">IE</acronym> whereas <em>with</em> the for attribute, the option/control is selected when you click on the label text.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick Webb</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-109482</link>
		<dc:creator>Nick Webb</dc:creator>
		<pubDate>Mon, 24 Sep 2007 16:33:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-109482</guid>
		<description>I have to say that I disagree here. The form element is meaningless without the label so I fail to see why encapsulating the form element within the label could be seen as bad.

Perhaps the name "label" is what's at fault. In actual fact the label element defines the form item and what it is the item is trying to capture. The form element really only provides the data format. In that context, it makes perfect sense to make the label element an integral, structural part of the form.</description>
		<content:encoded><![CDATA[<p>I have to say that I disagree here. The form element is meaningless without the label so I fail to see why encapsulating the form element within the label could be seen as bad.</p>
<p>Perhaps the name &#8220;label&#8221; is what&#8217;s at fault. In actual fact the label element defines the form item and what it is the item is trying to capture. The form element really only provides the data format. In that context, it makes perfect sense to make the label element an integral, structural part of the form.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Powers</title>
		<link>http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-109452</link>
		<dc:creator>Scott Powers</dc:creator>
		<pubDate>Mon, 24 Sep 2007 15:19:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2007/09/24/using-labels-in-a-nice-semantic-fashion/#comment-109452</guid>
		<description>Sad to say I've never done much with the label element. Mostly out of ignorance I'm sure. Great post though Robert. Some good stuff  you've got linked together here. Saving this one to snack on a bit later... or over and over again. Del.icio.us</description>
		<content:encoded><![CDATA[<p>Sad to say I&#8217;ve never done much with the label element. Mostly out of ignorance I&#8217;m sure. Great post though Robert. Some good stuff  you&#8217;ve got linked together here. Saving this one to snack on a bit later&#8230; or over and over again. Del.icio.us</p>
]]></content:encoded>
	</item>
</channel>
</rss>
