Improving label element discoverability
My good friend Andy is soliciting applications to be his other half via his blog. He’s a lovely guy, so go sign up! More importantly, the stylesheet for his romance test includes this gem:
label {
cursor: pointer;
}
I’m a huge fan of the greatly under-rated <label> element, but I’ve always worried about it’s low discoverability. I’d never thought of using CSS to change the mouse pointer. I’ve added that to my stylesheet and I’ll definitely be using it in the future.
Jesse Ruderman - 16th June 2003 06:19 - #
Matt - 16th June 2003 07:44 - #
James - 16th June 2003 08:29 - #
Good idea, although it wont work in IE5. Reason: IE5 doesnt know "pointer", all he knows is "hand"
To make it work on IE5 as well, use this:
label {cursor: pointer; cursor: hand;}Long live IE & web standards :/
(btw, this might break css's validation, read: this )
Lyon - 16th June 2003 09:05 - #
I have been using this on my site for awhile myself. It does have issues with Netscape 6.0-7.01 though, since their support for
labelis broken. So oftentimes thelabelwill actually do nothing when clicked, and the cursor change just misleads the user.Bill Mason - 16th June 2003 09:13 - #
I agree that this effect cna be slightly odd on labels which are linked to text fields, but it really comes in to its own when dealing with labels for checkboxes and radio buttons (which are the elements that most benefit from labels in the first place). I suppose it could be limited to just those labels using a hard-coded class, or maybe a bit of DOM driven Javascript that dynamically applies the class to labels linked to those kinds of input element.
I know there are a few problems with label support in certain older versions of the Netscape 6/7 series (the float label bug is particularly nasty) but as far as I'm concerned the benefits of using it far outweigh the negatives.
Simon Willison - 16th June 2003 09:40 - #
Aaron Brazell - 16th June 2003 14:16 - #
I use styled labels a long time ago. I think, each changing of focus should be clearly indicated. I use also:
label:focus { background: #fff /* whatever get's attention */ }Thomas
Thomas Scholz - 16th June 2003 21:36 - #
Anne van Kesteren - 17th June 2003 16:52 - #
Beate - 18th June 2003 00:35 - #
Michel - 19th December 2003 21:01 - #