Forum Moderators: open

Message Too Old, No Replies

<label> support

Do any browser have problems with them?

         

mep00

3:51 am on Jan 1, 2004 (gmt 0)

10+ Year Member



I think I remember reading that some browsers don't support <label> tages. Is this true? and if so, which ones?

What about CSS support?

tedster

7:08 am on Jan 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



label is supported by Mozilla 0.9 and up, NN 6 and up, IE 5 and up. Safari is a no go.

CSS support is quite a mixed bag, especially because there is CSS1, CSS2, and soon, CSS3 - there are many bugs, hidden corners of non-support and so on. You've got to test your css cross browser to see what's going on, especially if you get fancy.

DrDoc

5:41 pm on Jan 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd like to add a comment that even though labels may be supported, they are quite quirky in some browsers. Sometimes it only works if the form element resides inside the label element, other times it works only if the form element resides outside the label.

mep00

7:09 pm on Jan 1, 2004 (gmt 0)

10+ Year Member



Thanks for the replies so far.

I wanted to write "good" HTML. It sounds like, for now, sice the "for" wasn't that important, instead of

<div><label>TEXT</label><input></div>
I'll just have to use
<div><span>....
It's too bad; problems in CSS support I sort-of understand, but we're talking stright HTML. For that, there's no excuse (except for browsers which pre-date the tag).

DrDoc

3:53 pm on Jan 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You should still use the label tag (including the for attribute). That way, compliant browsers will function properly, resulting in increased accessibility. Non-compliant browsers will simply give no weight to the label tag. But, nothing will break, so you don't lose anything. :)

mep00

8:42 pm on Jan 3, 2004 (gmt 0)

10+ Year Member



But, nothing will break, so you don't lose anything.
What about CSS? How can the tag be styled if it isn't supported? Can it still be floated? Or does it need to be nested inside a <span>?

DrDoc

10:03 pm on Jan 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Most browsers recognize the label tag. I have not experienced any problems in styling it in any of the commonly used browsers.

When I said that the functionality is "quirky" in some browsers I didn't mean the support as such... They just may not give focus to the right form element, depending on how it is used.

dcrombie

11:17 am on Jan 4, 2004 (gmt 0)



Safari will recognise the LABEL tag for styling - just not link it to the form element. I think this goes for most or all Mac browsers (I have 5 or so and have never seen a label behave as part of the element it is supposed to be linked to).