0

Semantic XHTML and the Label Element

Everywhere I look, it seems, I see references to using the label element within x/html and its importance with respect to forms for accessibility and usability.  All good stuff, but why just within forms?

I can think of a number of scenarios for which the label element is a good fit semantically.  Not surprisingly, since I'm writing this, I'm working on one such scenario now.  I'm literally applying a label to output provided in a variety of formats.  I see nothing in the XHTML specification that would prohibit me from using the label element outside of a form context, but nor do I see any discussion of this as a reasonable use, much less as a valid or desirable use.

Is there anything I don't know that would make the use of the label element outside of the context of a form invalid or unacceptable within the scope of existing standards, best practices or semantics?

 

RSL said:
 
Right on! I've been doing this myself. http://www.w3.org/TR/html4/interact/forms.html#h-1... states "[the] elements used to create controls generally appear inside a FORM element, but may also appear outside of a FORM element declaration when they are used to build user interfaces." I tested it in the validator and it passes. I think it's much more meaningful than span would be, em and strong often convey _wrong_ meaning and we won't even talk about using b or i.
 
posted 514 days ago
Add Comment Reply to: this comment OR this thread
 
Jean Reis said:
 
I know i'm kinda late to the party, anyway, I was just googling about this very subject (semantics of the label element), and I'm using it for, huh, labeling stuff. Better than span (does that even have a semantic value??), I think, and more specific than Definition Lists.
 
posted 368 days ago
Add Comment Reply to: this comment OR this thread
 
 
Nope. No semantic value at all in div or span. And definition lists don't really work (semantically) unless there's actually a definition involved. In my case, I was just labeling the data I was displaying.
 
posted 368 days ago
Add Comment Reply to: this comment OR this thread
 

Search

Rob  Wilkerson