I'm a newbie trying to update my old FrontPage 98 rendered web sites and bring them up to date. I've gone through some self-help books and web tutorials and gained enough confidence to buy Expressions4 and started the learning curve, only to find the CSS "hover" is NOT available in IE8. I've found the hover to be very useful in calling attention to links by changing their color.

Any suggestions? I know this can be done with a Java Script, but have even less knowledge of javascripts than CSS. Am I doomed?

Recommended Answers

All 3 Replies

only to find the CSS "hover" is NOT available in IE8. I've found the hover to be very useful in calling attention to links by changing their color.

Are you sure about that? The code below works fine for me. If anything, the lack of support would be in elements that are NOT links. For example, div:hover is not supported(AFAIK), but links have always been supported (at least since IE6).

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
<style type="text/css">
<!--
a:hover{background-color:yellow;color:red;}
-->
</style>

</head>
<body>
<a href="#">Hello</a>
</body>
</html>

As for javascript you can use the onmouseover and onmouseout attributes:

<div onmouseover="highlight(this)" onmouseout="highlight(this)">world</div>
<script language="JavaScript" type="text/javascript">
<!--
function highlight(e)
{
  if( e.style.backgroundColor=='yellow')
  {
  	e.style.backgroundColor='white';
	e.style.color='black';
  }
  else
  {
  	e.style.backgroundColor='yellow';
	e.style.color='red';
  }
}
//-->
</script>

Thanks so much! It does work now. I'm wondering if there might be a bug in Expression4. When I entered the code via that editor I got the error message - not that the syntax was wrong, but that the hover element was not supported by IE8 "in the current schema". I have much to learn, not the least of which is what the editor means by "schema".

In any case, the hover works now. I tried entering it thru Notepad and Notepad++.

Incidentally, I was ready to give up the fight until I got this timely response. I feel much less alone now, and am anxious to continue, hoping my questions back to this forum don't sound too stupid.

Thanks to hielo for this help, and to Dani for this fine resource.

I am not familiar with the editor mentioned so I can't help you with that.

As for the hover problem, there is another workaround:
http://www.xs4all.nl/~peterned/csshover.html

Just thought you might be interested.

Regards,
Hielo

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.