1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Having Different Coloured Links

Discussion in 'CSS' started by travoholic, Mar 15, 2006.

  1. #1
    Hey guys,

    I've just discovered how to make my link text change when it is scrolled over and all that fun stuff using CSS. Now I'm wondering how to have different sets of links do different things.

    For example I have a menu on the left of my page where links are dark red but have a menu at the bottom of my page with a black background and want to have my links here white or some other light colour.

    Thanks for any help!
    Kirsty
     
    travoholic, Mar 15, 2006 IP
  2. Old Welsh Guy

    Old Welsh Guy Notable Member

    Messages:
    2,699
    Likes Received:
    291
    Best Answers:
    0
    Trophy Points:
    205
    #2
    You just set them up as a different class in the css.
     
    Old Welsh Guy, Mar 15, 2006 IP
  3. just-4-teens

    just-4-teens Peon

    Messages:
    3,967
    Likes Received:
    168
    Best Answers:
    0
    Trophy Points:
    0
    #3
    use something like this in your css stylesheet

    a.botlink, a.botlink:visited, a.botlink:active { color:#FFFFFF;}
    a.botlink:hover { color:#CDCDCD; }

    then make your links look like this

    <a href="link.php" class="botlink">link text</a>
     
    just-4-teens, Mar 15, 2006 IP
  4. travoholic

    travoholic Well-Known Member

    Messages:
    299
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #4
    Thanks! So do I just leave my other link colour as is and add that as my second link colour? What if I want three?
     
    travoholic, Mar 15, 2006 IP
  5. just-4-teens

    just-4-teens Peon

    Messages:
    3,967
    Likes Received:
    168
    Best Answers:
    0
    Trophy Points:
    0
    #5
    yes.

    if you want another copy the above code and just change the class

    a.link3, a.link3:visited, a.link3:active { color:#FFFFFF;}
    a.link3:hover { color:#CDCDCD; }

    then make your links look like this

    <a href="link.php" class="link3">link text</a> ETC ETC
     
    just-4-teens, Mar 15, 2006 IP
    travoholic likes this.
  6. travoholic

    travoholic Well-Known Member

    Messages:
    299
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #6
    Great! Thanks for that!
     
    travoholic, Mar 15, 2006 IP
  7. just-4-teens

    just-4-teens Peon

    Messages:
    3,967
    Likes Received:
    168
    Best Answers:
    0
    Trophy Points:
    0
    #7
    no problem
     
    just-4-teens, Mar 15, 2006 IP
  8. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #8
    Also, if you are using divisions or specific tables for links you can change the links in that particular section. This way you don't need to add a class to each link.

    
    #mydiv a {color:#FFFFFF; text-decoration:none;}
    #mydiv a:hover {color:#FFFFFF; text-decoration:underline;}
    
    or 
    
    table td table td a {color:#FFFFFF; text-decoration:none;}
    table td table td a:hover {color:#FFFFFF; text-decoration:underline;}
    
    Code (markup):
    <div id="mydiv">

    <a href...
    <a href...

    </div>

    or

    <table>
    <tr>
    <td>

    <table>
    <tr>
    <td>

    <a href...
    <a href...
     
    jestep, Mar 15, 2006 IP
    kk5st likes this.