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

Coloring Links using HTML

Status
Not open for further replies.

dman1982dq

Technical User
Sep 20, 2005
1
US
I am making a website and I can not color my v-link, a-link, and link html commands on a table I made, list I have made, and on just basci web sites, also how do I add it to my style sheets, so that I do not have to code every page indiviually for those elements on the page? Your help will be greatly appreciated,
 
Give them a class and then you will be sorted.

Code:
<a href="#" class="myLinks">xx</a>

You can now style them all this way (regardless of where they are used):
Code:
<style type="text/css">
a {color:#999;text-decoration:none;}
a.myLinks:visited {color:#090;}
a.myLinks:hover {color:#900;text-decoration:underline;}
a.myLinks:active {color:#990;}
</style>

At least that's what I reckon.

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]

What is Javascript? faq216-6094
 
Jeff is exactly right, but I would suggest having your code in a seperate css file, that way you only have to edit the code once for it to reflect throughout your webpage. Just paste Jeff's style code into a txt file and name it stylesheet.css -- then save it in the same folder as your html. Then for every html page you make that you want to reference the stylesheet, just add this line in between your <HEAD></HEAD> tags.

<link rel="stylesheet" type="text/stylesheet" href="stylesheet.css">

Also Jeff, I'm about to read your faq :)
 
BabyJeffy said:
Give them a class and then you will be sorted.
No!!!

why would you give them a class?
dman1982dq hasn't suggested different colours for the links in different parts of the page...in which case, simply apply the style to the link itself.

Code:
a:link     {color:#999;}
a:visited  {color:#090;}
a:hover    {color:#900;}
a:active   {color:#990;}

<marc>
New to Tek-Tips? Get better answers - faq581-3339
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top