How to change link color when visited.

Discussion in 'CSS' started by Skinny, Feb 2, 2007.

  1. #1
    Yup, I know of the a:visited thing, but the problem is that it doesn't work when someone clicks on a link that opens a new page.

    How does one go about changing the link color as soon as it is clicked?

    Thanks

    Skinny
     
    Skinny, Feb 2, 2007 IP
  2. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #2
    you can use

    a:hover

    when the mouse roams over it the link will change colors.

    I don't believe there is a way.. at least not using css....
     
    jfontestad, Feb 2, 2007 IP
  3. Skinny

    Skinny Peon

    Messages:
    1,864
    Likes Received:
    93
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hmm darn. :).

    Maybe its javascript using the onclick command? and then using it to affect the style sheet?

    Skinny
     
    Skinny, Feb 2, 2007 IP
  4. aplus

    aplus Well-Known Member

    Messages:
    83
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    115
    #4
    use

    a:link
    for normal unvisited links

    a:visited
    for visited links

    a:active
    for active links.

    a:hover
    for hovered links.
     
    aplus, Feb 2, 2007 IP
  5. jared

    jared Peon

    Messages:
    231
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Skinny is right, you would have to use a line of javascript if I understand what you are trying to do

    I'm not even sure this line works but it would look something like
    
    <a href="http://" onClick="this.style.color='#000'">link</a>
    
    Code (markup):
    either way you are gonna needs some js

    cheers
     
    jared, Feb 2, 2007 IP
  6. Skinny

    Skinny Peon

    Messages:
    1,864
    Likes Received:
    93
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks Jared. Gonna test it out.

    Skinny
     
    Skinny, Feb 3, 2007 IP
  7. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #7
    You're basically altering the active state with JavaScript, so a:active { } will do the job. I think the only shortcoming is IE (which IIRC still doesn't support it in IE 7), but there are ways around that.
     
    Dan Schulz, Feb 3, 2007 IP