Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CSS - Simple hover question!

    Ok - this is going to sound stupid, but if you look at the code below, why does it only work if I have it like this?

    I'm trying to make the first line turn gray when hovering (but not the second line!)

    From what I read, I would assume that you need to specify the p as in:

    p#pid a:link
    p#pid a:visited

    But if I do that, the code doesn't work. Can somebody explain this to me? Thanks

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <style type="text/css" title="currentStyle" media="screen">
    p#pid a:hover {
    color:#999999; /* Gray */
    }
    #pid a:link {
    color:#ffff00; /* Yello */
    }
    #pid a:visited {
    color:#000000; /* Black */
    }
    </style>
    </head>
    <body>
    <div id="divid">
    <p id="pid">This is a test <a href="#">Click</a></p>
    <p id="p2id">This is another test <a href="#">Click 2</a></p>
    </div>
    </body>
    </html>

  • #2
    New to the CF scene
    Join Date
    Feb 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    OK - never mind - I found the answer - hover must come after :link and :visited. :S


  •  

    Posting Permissions

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