CSS navbar rollovers break in IE

liunx

Guest
Hello,

Can anyone tell me why these CSS rollovers don't return to the normal state in IE? Here's the link (<!-- m --><a class="postlink" href="http://home.earthlink.net/~bnault1/web/">http://home.earthlink.net/~bnault1/web/</a><!-- m -->)

Here's the code:

<html>
<head><link href=http://www.webdeveloper.com/forum/archive/index.php/"style.css" rel="stylesheet" type="text/css" /></head>
<body>
<div id="mainnavbar"><ul><li><a href=http://www.webdeveloper.com/forum/archive/index.php/"../index.html">Home</a></li><li><a href="#">Link 1</a></li><li><a href="#">Link 2</a></li><li><a href="#">Link 3</a></li><li><a href="#">Link 4</a></li><li id="portallink"><a href="#">Link 5</a></li></ul>
</div>
</body>
</html>

CSS:

a:link, a:visited {
font: bold 10px Verdana, Arial, Helvetica, sans-serif;
color: #666;
text-decoration: none;
}
div#mainnavbar {
background-color: #666;
width: 750px;
padding: 0;
height: 20px;
margin: 1px 0;
}
div#mainnavbar ul {
list-style-type: none;
padding: 0;
text-align: center;
margin: 0;
}
div#mainnavbar ul li a, div#mainnavbar ul li a:visited {
color: #CCC;
display: block;
height: 20px;
line-height: 20px;
padding: 0;
margin: 0;
width: 125px;
}
div#mainnavbar ul li {
float: left;
}
div#mainnavbar ul li a:hover, div#mainnavbar ul li#portallink a:hover {
text-decoration: none;
color: #333;
background-image: url(images/bg_drk.gif);
width: 125px;
margin: 0;
padding: 0;
}



Thanks!I have no idea what's causing that, however, there is a work-around.

div#mainnavbar ul li a, div#mainnavbar ul li a:visited {
padding: 0px;
display: block;
margin: 0px;
width: 125px;
color: #ccc;
line-height: 20px;
height: 20px;
background-color: #666;
}
div#mainnavbar ul li {
float: left;
background-image: url(images/bg_drk.gif);
}
div#mainnavbar ul li a:hover, div#mainnavbar ul li#portallink a:hover {
padding: 0px;
background-color: transparent;
margin: 0px;
width: 125px;
color: #333;
text-decoration: none;
}

CSS Background Image Switching (<!-- m --><a class="postlink" href="http://www.dynamicsitesolutions.com/css/background_image_switching/">http://www.dynamicsitesolutions.com/css ... switching/</a><!-- m -->)Just add:#mainnavbar ul li a, #mainnavbar ul li a:visited {
background:#666;

If you change the :hover background the 'normal' state has to be changed too.

Selectors with id are unique, so don't require any tags before them. It only slows the css parsing.
Not div#mainnavbar ul li a but #mainnavbar ul li a
Not div#mainnavbar ul li#portallink a:hover but #portallink a:hover
 
Back
Top