Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS selector for label using "for" attribute in IE 6,7

I have a label in my web page as label for="title" How can i style this specific label element?

like image 721
srinath Avatar asked Dec 01 '22 04:12

srinath


2 Answers

you can assign it an id

<label for="title" id="label-title">TITLE</label>

then apply some css, eg

#label-title{font-weight:bold}
like image 78
Rocket Ronnie Avatar answered Dec 03 '22 23:12

Rocket Ronnie


Since IE6 doesn't support attribute selectors, you might consider specifying a class attribute to your <label /> and select it with it. (See How to workaround: IE6 does not support CSS “attribute” selectors)

With IE7, you could just do this:

label[for="title"] {
   font-weight: bold;
   /* ... */
}

See jsfiddle.net/GWNXq.

like image 43
Bertrand Marron Avatar answered Dec 04 '22 00:12

Bertrand Marron