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.

How to have many colors in hyperlinks?

Discussion in 'CSS' started by fryman, Apr 23, 2005.

  1. #1
    The hyperlinks in my page are red. I am using a div tag to put up some text, and there are a few hyperlinks there. I want to use different color in that div, how can I do it?

    My css is more or less like this:

    Then I use a <div align=center class="style">

    with

    Is this correct? What do I need to add to have the hyperlinks in the div show a different color?
     
    fryman, Apr 23, 2005 IP
  2. ashiezai

    ashiezai Peon

    Messages:
    927
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    0
    #2
    i think u can set a few style like

    .a { bla bla }
    .b { bla bla }

    then inside the <a> tag it goes like this:
    <a href="x.html" class="a">link1 red</a>
    <a href="y.html" class="b">this is diffirent color</a>

    correct me if im wrong .. im not very sure about this. :)
     
    ashiezai, Apr 23, 2005 IP
  3. fryman

    fryman Kiss my rep

    Messages:
    9,604
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    370
    #3
    Yeah, I read something like that, but what I want to do is have the coop ad's text in a different color, and I can't see any href there.
     
    fryman, Apr 23, 2005 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #4
    You can also do this

    a {
     text-decoration: none;
     border-bottom: 1px solid red;
     color: Lime;
    }
    Code (markup):
    which makes the links show with lime text and a red underline, mmm, not pretty!

    Sarah
     
    sarahk, Apr 23, 2005 IP
  5. fryman

    fryman Kiss my rep

    Messages:
    9,604
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    370
    #5
    Yup, but that will change the color on all the links on my page, I want to change just the coop ones, which are inside the div.
     
    fryman, Apr 23, 2005 IP
  6. ashiezai

    ashiezai Peon

    Messages:
    927
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    0
    #6
    may be u should try to set the color of the co-op link in the BODY

    then whatever links u want you could set another style and using the <a href="x.html" class="a">
     
    ashiezai, Apr 23, 2005 IP
  7. fryman

    fryman Kiss my rep

    Messages:
    9,604
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    370
    #7
    That's what I ended up doing, but there MUST be a way to do that in the div, the other way is too complicated, you have to style every single href on your page.
     
    fryman, Apr 23, 2005 IP
  8. Corey Bryant

    Corey Bryant Texan at Heart

    Messages:
    1,126
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Remember an element can have more than one class.
    
    div.style {
    font-family: verdana;
    font-size: 2mm;
    color: #FFCC66
    }
    div.box a:link, div.box a:visited 
    {
         color: #3C3C3C;
         text-align: center;
         margin-left: 45px;
    }
    div.box a:hover, div.box a:active
    {
         color: #FF0000;
         text-decoration: none;
         margin-left: 45px;
    }
    Code (markup):
    and then
    <div class="style box">
    Code (markup):
     
    Corey Bryant, Apr 24, 2005 IP
  9. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Not a CSS expert but can't you call one class say 'nav' and one 'body' and then go

    nav.a { stuff here}
    body.a {other colour and stuff here}
     
    T0PS3O, Apr 24, 2005 IP
  10. Solicitors Mortgages

    Solicitors Mortgages Well-Known Member

    Messages:
    2,217
    Likes Received:
    139
    Best Answers:
    0
    Trophy Points:
    103
    #10
    dont know if this helps
    but i have this which does all the hyperlinks in a cell...
    could 'td' could be substituted for div?
    (i read 'hover' has to be on a seperate line :confused: )

    <td class="tablez15" width="69">


    #tablez15 td
    {background-image: url(pics/bgb.gif);
    background-repeat: repeat;
    font-size: 13px;
    font-family: verdana;
    font-weight: bold;
    text-align: center;
    vertical-align: top;
    line-height: 18px;}

    #tablez15 a:link, #tablez15 a:visited, #tablez15 a:active {
    color: #000080
    }

    #tablez15 a:hover {
    color: #C0C0C0
    }
     
    Solicitors Mortgages, Apr 24, 2005 IP