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!

Selective CSS Formatting (Specific Table Only) 2

Status
Not open for further replies.

BoulderBum

Programmer
Jul 11, 2002
2,179
US
I want to have links in a certain table formatted a specific way. I know I can say:

TABLE TR TD A
{
//formatting
}

Or something for ALL tables, but I was wondering how I would apply it to just a single table. Something like assigning a class to a table where all of the links within the table are formatted in a certain way.
 
You're on the right track. Try this:

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

Code:
<style type=&quot;text/css&quot;>
<!--
	table.SpecialLink tr td a:link{
		color:#FF0000;
	}
	table.SpecialLink tr td a:visited{
		color:#00FF00;
	}
	table.SpecialLink tr td a:hover{
		color:#FF00FF;
	}
	table.SpecialLink tr td a:active{
		color:#0000FF;
	}
-->
</style>

You can change the colors as you see fit. Then, in any of the tables you want special colors just give them a class of &quot;SpecialLink&quot;. Example:

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

That should do it.

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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top