Hi Lisa,
The problem here is that the pseudo-classes only apply to links. CSS 2
specifies that the "hover" pseudo-class is not limited to links (but does
not specify what it *does* apply to), but I tested it using divs and tables
in both IE and FireFox, and it only works on links in both browsers.
So, I came up with an alternate solution for you. You start with a style
sheet that defines a class for the hover properties:
<style><!--
a:link.menu
{ text-decoration: none; background: #C46B2F; color:#000000; }
a:visited.menu
{ text-decoration: none; color:#23306D; }
..menu-hover, a:hover
{ text-decoration: none; background: #EFE0C0; color:#0000FF; }
--></style>
Note that the "link" and visited are specifically applied to links. That is
because they can only *be* applied to links. The class is not as of yet
assigned to any elements in your page. Now you add a JavaScript function to
add or remove the class from any element:
<script type="text/javascript"><!--
var curBackground, curcolor;
function setStyle(el, onOff)
{
if (onOff == true)
el.className = "menu-hover";
else
el.className = "";
}
//--></script>
This function sets the className (CSS class) to the HTML element passed to
it when "onOff" is true. Otherwise, it sets the className to blank.
All that remains is some mouse-handling:
<table border="1" cellpadding="0" width="100%" bordercolor="#000000">
<tr>
<td bgcolor="#C46B2F" onmouseover="setStyle(this, true)"
onmouseout="setStyle(this,false)"><a href="indexnew.htm">Home</a></td>
</tr>
<tr>
<td onmouseover="setStyle(this, true)"
onmouseout="setStyle(this,false)">Real Estate</td>
</tr>
</table>
Note that the cell containing "Real Estate" does not have a link in it. I
did this to demonstrate that the JavaScript is not dependent upon anything
to do with links, but is applied to the element passed to it, in this case,
a table cell.
Now, the class does specify some "link-only" style properties. But these do
not apply to the table cell. They *do* apply to any link *in* the table
cell, however.
--
HTH,
Kevin Spencer
Microsoft MVP
Professional Numbskull
Hard work is a medication for which
there is no placebo.