Results 1 to 8 of 8

Thread: targeting label with css

  1. #1
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default targeting label with css

    How do I target a particular label in my css using the for="ctrl_notes"? (its the label of a textfield with id of #ctrl_notes .... but #ctrl_notes label doesn't work)

  2. #2
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: targeting label with css

    Code:
    label[for=ctrl_notes]
    Can't you give it a class or id? This method is not yet 100% supported.

    Also see: http://www.w3schools.com/css/css_attrib ... ectors.asp

  3. #3
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: targeting label with css

    Thanks Ruud.
    That works fine, but I think I will give the label a class so IE doesn't feel left out.

  4. #4
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: targeting label with css

    IE6 is a 10 year old great-grandfather. It doesn't feel left out, it just wants to die. All successors should support the selector? But since it is still used it would be wise to use classes!

  5. #5
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: targeting label with css

    IE 7 didn't like it either unfortunately.

  6. #6
    User
    Join Date
    06-19-09.
    Posts
    89

    Default Re: targeting label with css

    Hi ramjet, I'm not sure if this helps, but if you want to isolate a class for IE 6 you can put *html in front of your css selector.

    *html #main { width: 500px; }

    That will make the main column 500 pixels in Internet Explorer 6 only. Not sure if it also works for IE 7

  7. #7
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: targeting label with css

    All good to know, thanks Justin :D

  8. #8
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: targeting label with css

    Quote Originally Posted by Justin
    ... in Internet Explorer 6 only. Not sure if it also works for IE 7
    :|

    I've never used that hack, but understand it should be ie6 and below. Otherwise you can always use conditional comments in your html:
    Code:
    <!--[if IE 6]>
    Special instructions for IE 6 here, lyke <style>....</style> and so on...
    <![endif]-->

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •