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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS: TD hover 4

Status
Not open for further replies.

webmigit

Programmer
Aug 3, 2001
2,027
0
0
US
I know it can be done because some sites do it...

My TD class is "leftTDMargin2Px"... How can I say like... td:hover? for this class so that it automatically changes on hover? I want to like change the td background color during hover..

Tony Did I help?
Vote!
 
put this in your td tag onmouseover="this.style.background='color';"
and then also put this if you want the color to go back
onmouseout="this.style.background='color';"

and you are done [soapbox]
sleep is good
 
use JS to do that. Hover is a pseudo selector for anchors only (A:hover for example).

<td onmouseover=&quot;this.className = 'leftTDMargin2Px'&quot; onmouseout=&quot;this.className = 'leftTDMarginWhite2Px'&quot; class=&quot;leftTDMarginWhite2Px&quot;>put mouse over me</td>

Simply have two different classes with the different styles. Gary Haran
 
Standards compliant browsers such as Mozilla/Netscape 7 will support the hover pseudo class for elements other than A:

This works in Mozilla/NS7, not in IE... yet anyway :)

JimS.
------------------------------------------
<html>
<head>
<title>ooo</title>
<style>
td.liter:hover { color:red;background-color: yellow }
</style>
</head>
<body>
<table width=&quot;500&quot;>
<tr>
<td>Hey</td>
<td>I am</td>
<td>Not colored</td>
</tr>
<tr>
<td>Hey</td>
<td>I am</td>
<td class=&quot;liter&quot;>Mouse Over Me!!</td>
</tr>
<tr>
<td>Hey</td>
<td>I am</td>
<td>Not colored</td>
</tr>
</table>
</body>
</html>
------------------------------------------ JimS.
aka
TenTonJim

Looking for work:)
 
well i'll be!!!! a star for you TenTonJim!! :) Teaching me somthing I didn't know is worth that! :) i'll go to bed less stupid tonight! :) Gary Haran
 
Reading aol.com will fix all lack of stupidity... :)

But yeah... I'm an IE person but he's right, twas cool.. he gets another star...

Feels like kindegarten, no?

Ok Jimmy, you've been a good boy, you get a purple star sticker.

Tony

Did I help?
Vote!
 
actually you know what it does feel like kid's stuff! :) yet it all feels like an overly easy exercise in game theory we'd see in university! :)

I give stars to people who prove me wrong, show me new things I didn't know or simply figure out a more elegant way of doing what I do! :) Gary Haran
 
Thanks a lot. I am totally into CSS and just seeing what the Gecko browsers support vs. IE is ... well a pretty big gap! Gecko rocks for css!!!

Alas IE has about 90% market share but hopefully someday that will either turn around or IE will support advanced css (make that web standards!)

I try to push all clients towards web standards...

Thanks for the stars :) that was my first post I just signed up today.

JimS. JimS.
aka
TenTonJim

Looking for work:)
 
Good boy..

Congrats, you got more votes on the first post than most do in ten posts...

People don't vote... I hate that...

Vote for me if I help, that's my thing..

And I watch screen names, if I properly answer a question and don't get my little purple sticker, I'll remind 'em, if they just don't, I don't answer their questions anymore...

Figure I'm worth $125 an hour and their getting me for free... they can click a little link... Notice my signature?

Tony

Signature down below

|
|
|
\ / Did I help?
Vote!
 
lol.. um... whoever voted my post helpful.. I didn't mean vote this one helpful, I asked the question... I was just saying that ya know when you help, its nice for people to vote, oye, I give up ;)

Tony Did I help?
Vote!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top