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

Specific links one colour, other links another

Status
Not open for further replies.

ameslee

Programmer
Feb 12, 2006
34
0
0
AU
hope someone can help me? how do you make specific links one colour and other links another. I have text links in my menu and other links on the page within the content, i want to change the colours of the links in the menu. How do i do this?

thanks
 
Assuming the menu container has an ID of "menu", you could do this:

Code:
a {
   /* colouring for generic links goes here */
}
#menu a {
   /* colouring for menu links goes here */
}

or, if your content container has an ID:

Code:
a {
   /* colouring for menu links goes here */
}
#content a {
   /* colouring for content links goes here */
}

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
The easiest way is to assign a class to one of the links. A better approach would be to assign specific styling for the links dependant on inside which element they lie in. This would involve using descendant selectors and the important advantage of that is that your html is a lot less cluttered this way. Your navigation will be in one container and your content in another. Based on that you can style your links like so:
Code:
#navigation a {
 ...
}

#content a {
 ...
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top