quick "a link" question

Discussion in 'CSS' started by fadetoblack22, Apr 27, 2008.

  1. #1
    I have a class = "white_text"

    I want links of that class to be different to the rest of the page. I have used this css, but it doesn't work:

    a.white_text:link {
    color: white;

    }
    a.white_text:visited {

    color: white;
    }
    a.white_text:hover {

    color: #FF0000;
    }
    a.white_text:active {

    color: #990000;
    }


    Could someone correct this for me please.

    thanks
     
    fadetoblack22, Apr 27, 2008 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #2
    
    .white_text a:link {
      color: white;
      }
    
    .white_text a:visited {…}
    .white_text a:focus {…}
    .white_text a:hover {…}
    .white_text a:active {…}
    Code (markup):
    cheers,

    gary
     
    kk5st, Apr 27, 2008 IP
  3. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ^ isn't that if the links are in a parent with the class of white_text?

    I thought s/he meant that the links themselves had the class.

    a.white_text {
    color: #f00;
    }

    If I understood correctly, and it's the links themselves with that class, then the above will make any link at all with that class have a white colour.

    Then, you only wanted the active version of white_text to have a different colour?

    a.white_text :active {
    color: #900;
    }

    But I'm la famosa for misunderstanding things... if the links are in a box with the class of white-text then Gary's code above is the way to do it. Just remember that if you want everyone to act the same, it's less code to set those properties on a itself (not a:link, which cannot pass anything down to the other : properties) and then only list the ones that are different.
     
    Stomme poes, Apr 28, 2008 IP