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 - Changing table cell background on mouseover

Discussion in 'CSS' started by norfstar, Jan 30, 2005.

  1. #1
    I'm having a few headaches getting this to work how I want it -
    SEMrush
    I've currently got:

    table.nt td a{display: block;} 
    table.nt td a:link, table.nt td a:visited {} 
    table.nt td a:hover, table.nt td a:active {background-image: url('/li/left-gradient-hover.gif'); color: #FFFFFF; text-decoration: none;} 
    .lnl {margin-left: 10px; margin-top: 2px; margin-bottom: 2px;}
    Code (markup):
    with HTML like:

    <table class="nt" width="140" border="0" cellpadding="0" cellspacing="0"> 
    <tr><td class="nc"><a href="/link/" class="lnl">Link</a></td></tr></table>
    Code (markup):
    However onmouseover the margin pixels remain the old background. I've tried using padding on the cell, using a <div>, but I still get the same outcome.

    Does anyone have any ideas how I get get this so it changes the whole cell including any padding/margins?

    The website incidentally is ngaming*co*uk
     
    norfstar, Jan 30, 2005 IP
    SEMrush
  2. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    64
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Margins are always transparent. If you want the image to fill the entire cell, set cell's padding and cell contents' margins to zero. Use cell contents' padding to control the distance between the borders and the contents.

    J.D.
     
    J.D., Jan 30, 2005 IP
  3. norfstar

    norfstar Peon

    Messages:
    1,154
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks :) - I've got it working now.
     
    norfstar, Jan 30, 2005 IP