Forum Moderators: not2easy
I am trying to make a simple rollover happen within a complicated data table. I have this working in IE 6&7 but am having difficulties in FF.
My requirements call for me to have the href tag within a <td>. I need to have the whole table highlight on rollover. It links, text color changes, but the rollover effect is missing. Again it works in IE, but not FF. Any insight would be hugely appreciated.
Here is a sample of my code:
<style type="text/css">
<!--
a:link, a:visited{color:#ccc;text-decoration:none;background:#289;}
a:active, a:hover{background:#555;colo}
-->
</style>
<table>
<tr>
<td>one</td>
<td><a href="">
<table>
<tr><td>link</td>
</tr>
</table>
</a></td>
</tr>
</table>
....<td><a href="">
<table>
<tr><td>link</td>
</tr>
</table>
</a></td>.....
Use just the anchor, and style it somehow to "fill" the TD. This is a better solution anyway, nested tables are bad mojo for accessibility.
<td><a class="whatever" href="">link</a></td>
.whatever { display: block; height:40px; width:200px; }
... then follow with your hover styles.
The width and height are examples, but this approach will probably lead to a solution as long as you use a valid doctype.
Let's go with this:
....<td><a href="" class="whatever">
<table>
<tr><td>data</td><td>data2</td>
</tr>
<tr><td>data</td><td>data2</td>
</tr>
</table>
</a></td>.....
then for the style I have:
a.whatever:link, a.whatever:visited {background:#transparent;width:100%;padding:0;color:#000;text-decoration:none;display:block;}
a.whatever:hover{background:#aec3d0;}
Thanks for your help!
DOC TYPE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
Thank you for your help. The data display is complex and persnickety. The client is requesting the rollover effect. I am trying to give my clients what they want... but understand limitations. Before I gave up, I wanted to reach out and find out if there might be some answer - while the above may work in some instances, for my special case it does not.
Thank you both for your wonderful insights
a
a:active, a:hover{background:#555;colo}
The other thing I've noticed recently is that using shorthand ways to set things might have unintended side-effects in both the standard as well as in firefox.
If you only intend to set the color, and not change other background settings, I'd recommend
"background-color:#555" over "background:#555" background:#555 as if you wrote: background-color: #555555;
background-image: none;
background-repeat: repeat;
background-attachment: scroll;
background-x-position: 0%;
background-y-position: 0%;
a:link, a:visited{color:#ccc;text-decoration:none;background:#289;}
a:active, a:hover{background:#555;colo} LVHA
Link
Visited
Hover
Active
Change the order of your rules to...
a:link, a:visited{
color:#ccc;
text-decoration:none;
background:#289;
}
a:hover, a:active{
background:#555;
} The rollover effect is missing due to the incorrect order.