Click to See Complete Forum and Search --> : onMouseOver And Table Cell Color


KingG
08-01-2003, 01:39 PM
Is there a simple way to have a table cell change color whenever the mouse is placed over an image, and back to it's original color using CSS and/or onMouseOver/onMouseOut?

Jonathan
08-01-2003, 03:46 PM
Dont use tables! :)


A:link,A:visited
{
background-color:black;
color:white;
display:block;
}

A:hover
{
background-color:white;
color:red;
display:block;
}

pyro
08-01-2003, 05:24 PM
Table are a perfectly fine way to present tabular data. Also, to answer the original question, try this:

<table>
<tr>
<td onmouseover="this.style.backgroundColor='#eeeeee';" onmouseout="this.style.backgroundColor='transparent';">Your Data</td>
</tr>
</table>

PeOfEo
08-01-2003, 06:04 PM
very similar to my code in another post pyro :) But I have never seen that transparent thing, I have always just specified a bg color and set back to that color. Ill have to remember that one.

pyro
08-01-2003, 06:09 PM
Yeah, since I never set a background color in the first place, I wouldn't want to specify a color onmouseout. If, however, I'd have set a background color (on either the table or the cell) I would have wanted to set it back to that color (in cascading order)

PeOfEo
08-01-2003, 06:12 PM
Yes but this way It would not interfear with a background image that someone might use.