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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hyperlink colors

Status
Not open for further replies.

trent101

Programmer
Nov 4, 2005
50
0
0
AU
Hey,

I have a problem on my site where I would like the color of one set of links to be different to the color of another.

For instance, the 'mini menu' down the bottom is on a dark background, so i would like them to be white in color.

However the rest of the main content is on a white background, so if I specify this in my style sheet:

A:link
{
color...
}

A:visited
{
color....
}
etc...

it does make my mini menu links white but also makes all the other links white to!

Is there any way to fix this so only my links down the bottom are white?

Cheers.
 
Set your white links up as a class in your style sheet, like this:

.whitelinks { font-family: Arial, Helvetica, sans-serif; color: yellow; text-decoration: none }

The key here is to set your text decoration as none, or underlined if you want, this will override the default link settings.
You would then set up your links like this:

<a href="somepage.html" class="whitelinks">Some Page</a>

You can then leave the other links on your page at the default decoration (blue, underlined, purple visited, etc.) or set them up as their own class.
 
Even better is to use the descendants. Say your minimenu is defined via an id:
Code:
a:link {
  color: red; /* every link is red */
}

#minimenu a:link {
  color: white; /* all links within #minimenu are white */
}
It makes your html less cluttered and easier to change.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top