1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

CSS Change background of a cell with a link?

Discussion in 'CSS' started by Weirfire, Mar 31, 2005.

  1. #1
    Is it possible to change the background of a cell when you hover over a link?

    I know you can use images but I was thinking you could maybe do something like

    a:hover {color: #BD0303; text-decoration: underline ; td { background: white}}

    Is there an easy way of doing this?
     
    Weirfire, Mar 31, 2005 IP
  2. norfstar

    norfstar Peon

    Messages:
    1,154
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I've got an effect like the one you've described on my website ngaming*co*uk, but it changes the cell background image rather than background color.

    In IE it only shows up when hovering over the link, whereas in Firefox it changes when hovering over any part of the table cell.
     
    norfstar, Mar 31, 2005 IP
    Weirfire likes this.
  3. Lever

    Lever Deep Thought

    Messages:
    1,823
    Likes Received:
    94
    Best Answers:
    0
    Trophy Points:
    145
    #3
    Check out ala's taming lists article, really good it is - scroll down 'til you see the blue menu system - that's a good way to try css for button effects ;)
     
    Lever, Mar 31, 2005 IP
  4. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #4
    Weirfire, Mar 31, 2005 IP
  5. nevetS

    nevetS Evolving Dragon

    Messages:
    2,544
    Likes Received:
    211
    Best Answers:
    0
    Trophy Points:
    135
    #5
    You can check out my weddings site - www.bkweddings.com

    There is a css menu system on the upper left, and mouseover hovers on the right in the sidebar. It's all css based and works the same across browsers as far as I know.
     
    nevetS, Mar 31, 2005 IP
    Weirfire likes this.
  6. SoxFan

    SoxFan Peon

    Messages:
    90
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    The only way to do that is with some js. Much the way the link in Weirfire's post suggests.
     
    SoxFan, Apr 14, 2005 IP
  7. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #7
    I dont think so.

    It's done using CSS. There's absolutely no JS involved. Where did you think it was javascript?
     
    Weirfire, Apr 14, 2005 IP
  8. Epica

    Epica Well-Known Member

    Messages:
    1,007
    Likes Received:
    95
    Best Answers:
    0
    Trophy Points:
    170
    #8
    Simplified version:

    <td onmouseover="this.className='cell_over';" onmouseout="this.className='cell_out';" bgcolor="#000000">

    add this to your CSS:

    .cell_over { BACKGROUND-COLOR: #ffffff}
    .cell_out { BACKGROUND-COLOR: #000000}

    Edited: Oops - I just visited and read the link Wiers post - already says all of this ;)
     
    Epica, Apr 14, 2005 IP
  9. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #9
    That's Great Azakers! I'm always happy to tidy up my code in any way I can. Sometimes I tidy too much and have a huge list of includes(PHP) and then I have to start tidying my includes. :eek:
     
    Weirfire, Apr 15, 2005 IP