Link colors

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
[n00b]
Forum Commoner
Posts: 34
Joined: Sat Mar 20, 2004 7:06 pm

Link colors

Post by [n00b] »

I use CSS to change how the links look (when mouse over etc.)
However this applies to the whole page. How can I do that to each link or to all links in a table cell separately?
Draco_03
Forum Regular
Posts: 577
Joined: Fri Aug 15, 2003 12:25 pm
Location: Montreal, Canada

Post by Draco_03 »

for exemple you create that in your css

Code: Select all

a.smallmenu {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	font-weight: normal;
	text-decoration: none;
	color: #7D85BD;
}
a:hover.smallmenu {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	font-weight: normal;
	text-decoration: none;
	color: #3E498E;
}
and in your code you make

Code: Select all

<a href="home_fr.php" class="smallmenu">home</a>
you can create as many sub class as you want..
[n00b]
Forum Commoner
Posts: 34
Joined: Sat Mar 20, 2004 7:06 pm

Post by [n00b] »

how to apply this to a table cell or to a whole table?[/pg_man]
[n00b]
Forum Commoner
Posts: 34
Joined: Sat Mar 20, 2004 7:06 pm

Post by [n00b] »

noone knows ? :(
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Find a website that does this and look at their code. It should just be the same .hover css, but applied to the <td> background instead of the link:

Code: Select all

.highlight.hover &#123;
   background: #FF1111;
&#125;

<table>
   <tr>
      <td class="highlight">
         Test
      </td>
   </tr>
</table>
coreyb
Forum Newbie
Posts: 3
Joined: Mon May 31, 2004 6:20 pm
Location: Salt Lake City, Utah

Post by coreyb »

Use

Code: Select all

table.tablename a
&#123;
color: #FF0000;
&#125;
table.tablename a:hover, a:visited
&#123;
color : #0000FF;
&#125;
This also goes for td.tdname or tr.trname. You should use them as per the following:

Code: Select all

<table width="500" border="0" cellspacing="0" cellpadding="5" class="tablename">
	<tr>
		<td><a href="#">link</a></td>
	</tr>
</table>
If you use them in the <td> or <tr> elements place the class in the tag.

Good Luck! :D
[n00b]
Forum Commoner
Posts: 34
Joined: Sat Mar 20, 2004 7:06 pm

Post by [n00b] »

coreyb wrote:Use

Code: Select all

table.tablename a
&#123;
color: #FF0000;
&#125;
table.tablename a:hover, a:visited
&#123;
color : #0000FF;
&#125;
This also goes for td.tdname or tr.trname. You should use them as per the following:

Code: Select all

<table width="500" border="0" cellspacing="0" cellpadding="5" class="tablename">
	<tr>
		<td><a href="#">link</a></td>
	</tr>
</table>
If you use them in the <td> or <tr> elements place the class in the tag.

Good Luck! :D
thanks man!
Post Reply