Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

css redefining the a:link 1

Status
Not open for further replies.

SteveAudus

Technical User
Oct 4, 2001
409
GB
I'm just starting a site, and redefined
the
a
a:link
a:visited
a:hover

which works fine,
All the links are set white, and turn black over hover.
but I would like just one link to look different,

How can I do this?

I have tryed defining it's own style,
but it just gets overwritten by the orginal css.

Any suggestions?


 
I am assuming you want one link on the page to be different from all the rest?

you'd need to create an id for the link
#newlink a:active
{
styles in here
}



----------------------------------------
Sometimes, when my code just won't behave, I take it outside and make it listen to britney spears music, and when it comes back it's really well behaved. I wonder if it's suffering from post tramatic stress syndrome now..
 
DaRNCaT

Thanks for the quick reply,

I have got it different colour but,
how do a get it to have a different hover colour?

The code from the attached css is below.

Thanks for your help on.


a:link {
color: #000000;
font-weight: bold;
}
a:visited {
color: #666666;
font-weight: bold;
}
a:hover {
color: #FFFFFF;
font-weight: bold;
}
.different a:link
{ color: #FFFFFF;
font-weight: bold;
}
.different a:hover
{ color: #000000;
font-weight: bold;
}


****************

Cheers,
Steve

 
you need an id not a class.

Code:
a:link {
    color: #000000;
    font-weight: bold;
}
a:visited {
    color: #666666;
    font-weight: bold;
}
a:hover {
    color: #FFFFFF;
    font-weight: bold;
}

#different a:link
{ color: #999999;
    font-weight: bold;
}
#different a:hover
{ color: #000000;
    font-weight: bold;
}
than to use it within the page
Code:
<p id="different"><a href="#">happylink</a></p>

if you want to use a class, so you can put it within the a href tag, you need to make a class like so

Code:
.different{
}
a.different:link
{ color: #999999;
    font-weight: bold;
}
a.different:hover
{ color: #000000;
    font-weight: bold;
}

you'd then use it like so
Code:
<a class="different" href="#">happylink</a>

----------------------------------------
Sometimes, when my code just won't behave, I take it outside and make it listen to britney spears music, and when it comes back it's really well behaved. I wonder if it's suffering from post tramatic stress syndrome now..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top