I have 2 different links, I want one to be blue (as an example) and the other to be red... but for some odd reason I can't see what's causing all of the links to be the same colors.... can someone help?
Thanks in advance!

Recommended Answers

All 5 Replies

Could you post your CSS file?
The easiest way to do it is with a class, something like this would work:

.LinkA a:link{
    font: 15px Arial;
    color: #FF0000; // Red
    text-decoration: underline;

.LinkB a:link{
    font: 15px Arial;
    color: #000DFF; // Blue
    text-decoration: underline;

Obviously you would want to change it to your styles, but that should solve any colour problems.

WOW... I can't believe i didn't notice that! You just solved everything... thanks :)


You have four types of links, a:link a:active a:visited and a:hover

a:link is your standard sort of link, the ones you see when you load the page
a:active is the link which appears when you click, by default it is red
a:visited is after the link has been clicked, by default it is purple
a:hover is when you mouse over, so you can do some cool things like underline them and change the font colours when moused over for additional clarity and style. It is a lot easier then using JS to do it for sure!

I hope that clarifies it, any more questions then just ask!

Its also a good practice to apply the styles in the this order:


You can use class or id attribute of anchor tag!

<a href="a.htm" id="red">
<a href="a.htm" id="blue">

And then use CSS.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.