SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    May 2006
    Posts
    291
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Change background colour of table cell on mouse over

    Is there an easy way to make the background colour of a table cell change on mouseover?

    Thanks

    Accel

  2. #2
    SitePoint Addict
    Join Date
    Nov 2004
    Location
    London
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not if you want to do it just with CSS and want it to work cross-browser (IE will only let you assign hover: to a link).

    But you do some really nice things if you add JavScript into the mix: highlight the cell, highlight the row, highlight the column... highlight all three. If this is of interest - and you need help with it - suggest starting a new thread in the JavaScript forum.

  3. #3
    Non-Member Egor's Avatar
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    7,305
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    As Gary has mentioned, IE6 and under will need a bit of JS. The neatest solution (for IE) I've seen to date is Whatever:hover.* Then, you can just use normal CSS:

    Code:
    td:hover { 
    background: pink;
    }
    
    OR...
    
    tr:hover td {
    background: blue;
    }
    And the script will sort IE out automatically.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •