/    Sign up×
Community /Pin to ProfileBookmark

onMouseOver And Table Cell Color

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?

to post a comment
CSS

5 Comments(s)

Copy linkTweet thisAlerts:
@JonathanAug 01.2003 — Dont use tables! ?

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

A:hover
{
background-color:white;
color:red;
display:block;
}
[/CODE]
Copy linkTweet thisAlerts:
@pyroAug 01.2003 — 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>
Copy linkTweet thisAlerts:
@PeOfEoAug 01.2003 — 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.
Copy linkTweet thisAlerts:
@pyroAug 01.2003 — 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)
Copy linkTweet thisAlerts:
@PeOfEoAug 01.2003 — Yes but this way It would not interfear with a background image that someone might use.
×

Success!

Help @KingG spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...