1

Possible Duplicate:
cols, colgroups and css :hover psuedoclass

How can I set the background color of an HTML table column when a cell (td) in that column is hovered over?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
campbelt
  • 1,573
  • 5
  • 27
  • 43
  • You're right. My question is a duplicate. I will edit this and link to your original question. Thank you! – campbelt Jun 23 '12 at 21:15
  • It can be done with just CSS. I just answered it over on @DavidThomas question: http://stackoverflow.com/q/848840/918414 – ThinkingStiff Jun 24 '12 at 09:02

1 Answers1

0

Perhaps you can get away with a hover on table instead of hover on td: http://jsfiddle.net/DkN2R/

If your tds doesn't have spacing / margin you can get away with it.

Otherwise you would have to resort to javascript, because CSS cannot handle ancestor selectors. I heard some rumors about them maybe in the far far future being implemented, but that may take a while. The reason for this was performance if I recollect correctly.

PeeHaa
  • 71,436
  • 58
  • 190
  • 262