#1
  1. So many bugs, so little time!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    Australia
    Posts
    36
    Rep Power
    12

    Question problem with CSS


    I use a stylesheet to define the style of 'a' i.e hyperlinks.
    it looks something like this:
    a {
    color:white;
    font-family:verdana, arial, helvetica, sans-serif;
    text-decoration:none;
    }
    a:link {color:white;}
    a:visited {color:white;}
    a:hover {background-color:white;
    color:#808080;
    }

    This works great, but how do I explicitly change the style of other hyperlinks on the same page. They would typically be in a div. I have tried all kinds of things anc just can't get it to work.
    Thanks a lot...
    Please turn over for witty signature.
    Chrisby
  2. #2
  3. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Oct 2001
    Location
    New Zealand
    Posts
    1,774
    Rep Power
    24
    Give your hyperlinks a class:

    <style type='text/css'>
    a.blueLink {color:blue;}
    a.blackLink {color:black;}
    </style>

    Then:

    <a href='#' class='blueLink'>blue link</a><br>
    <a href='#' class='blackLink'>black link</a>
  4. #3
  5. mod_dev_shed
    Devshed Supreme Being (6500+ posts)

    Join Date
    Sep 2002
    Location
    Atlanta, GA
    Posts
    14,817
    Rep Power
    1100
    Code:
    <div id="foo"><a href="link.html">Link</a></div>
    Code:
    #foo a:link
    or
    Code:
    <a class="foo" href="link.html">Link</a>
    Code:
    a.foo:link
    # Jeremy

    Explain your problem instead of asking how to do what you decided was the solution.
  6. #4
  7. So many bugs, so little time!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    Australia
    Posts
    36
    Rep Power
    12
    Thanks binky, that worked!
    Sorted!
    Please turn over for witty signature.
    Chrisby

IMN logo majestic logo threadwatch logo seochat tools logo