CSS class to override a:link a:active etc.

Discussion in 'CSS' started by minstrel, May 5, 2007.

  1. #1
    I want the links within a DIV class to override the definitions for links on the remainder of the page (dark background issue).

    This doesn't work:

    .myclass { font-size:x-small; font-weight:bold; color:white}
    a.myclass:link {color:white}
    a.myclass:visited {color:white}
    a.myclass:hover {color:red}
    a.myclass:active {color:red}
    Code (markup):
    The font properties, including color, in the first line work fine but the link properties do not override those defined for the page.

    How can I do this?
     
    minstrel, May 5, 2007 IP
  2. SoKickIt

    SoKickIt Active Member

    Messages:
    305
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    70
    #2
    
    .myclass { font-size:x-small; font-weight:bold; color:white}
    .myclass a:link {color:white}
    .myclass a:visited {color:white}
    .myclass a:hover {color:red}
    .myclass a:active {color:red}
    
    Code (markup):
     
    SoKickIt, May 5, 2007 IP
    minstrel likes this.
  3. minstrel

    minstrel Illustrious Member

    Messages:
    15,082
    Likes Received:
    1,243
    Best Answers:
    0
    Trophy Points:
    480
    #3
    Thank you! Perfect! :)

    Green headed your way. :)
     
    minstrel, May 5, 2007 IP