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!

Colours and links etc... 1

Status
Not open for further replies.

newphpbie

Programmer
Oct 17, 2003
110
GB
HI,

I'm using this line og code at the top of my page to set all the colors for the page.

Code:
<body bgcolor=&quot;#66FFFF&quot; text=&quot;#000000&quot; link=&quot;#000000&quot; vlink=&quot;FFFFFF&quot; alink=&quot;#FFD700&quot;>

Fine, it works...... however, further down my page I am printing a href to the screen which I need to have seperate colour properties to the ones declared earlier. Basically I'm asking for an example of how the assign unique colour attributes to a href and override the page defaults.

Could someone give me an example please. I know I could solve this using CCS but I don't have time and my preference is just to get the program functioning properly before I start thinking bout tarting it up some more.

TIA
 
newbie,

The easiest way to accomplish this is to use CSS. This kind of CSS not hard at all. In fact, I don't know that it can even be done without CSS. Try this:

The following piece of code goes into the
Code:
<head></head>
section of your document:

Code:
<STYLE TYPE=&quot;text/css&quot;>
<!--
  .SpecialLink:link {
  	color:#FF0000;
  }
  .SpecialLink:visited {
  	color:#00FF00;
  }
  .SpecialLink:hover {
  	color:#FF00FF;
  }
  .SpecialLink:active {
  	color:#0000FF;
  }
-->
</STYLE>

You can change the colors as you see fit. Then, in your link just give it a class of &quot;SpecialLink&quot;. Example:

Code:
<a href=&quot;test.html&quot; class=&quot;SpecialLink&quot;>different color link</a>

There you are. Piece of cake. AND, you've just started on your way to using CSS. Much of CSS really is very easy to use and can make your web site look sooooo much better.

Check out to see exactly what can be done using CSS. The different pages on this site use exactly the same html file, they just use a different CSS file.

Good luck,
-Ron

-We are all given the same deck of cards, it's how we play the hand we are dealt which makes us who we are.
 
Darkshadeau,

Good tip. I'll be using that one myself.

Thanks,

TwoOdd
--------------
Good judgment comes from experience, and experience comes from bad judgment.
-- Barry LePatner
 
Thanks.

Actually, not that it's all that important, but I just realized that I messed up (a little). You'll want to make the
Code:
<SCRIPT TYPE...>
and
Code:
</SCRIPT>
lowercase if you want them to be XHTML compliant. All tags and attributes need to be lowercase for XHTML.

-Ron

-We are all given the same deck of cards, it's how we play the hand we are dealt which makes us who we are.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top