I'm trying to create a menu using entirely CSS. An example of what I'm doing is this:
<div class="navborder1">
<img src=http://www.webdeveloper.com/forum/archive/index.php/"./images/graymenuheader.gif" alt="Menu">
<div class="navcell">
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./index.html" class="menulink">Homepage</a>
</div>
<div class="navcell">
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./about.html" class="menulink">About the Show</a>
</div>
<div class="navcell">
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./episodes.html" class="menulink">Episodes</a>
</div>
<div class="navcell">
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./characters.html" class="menulink">Characters</a>
</div>
<div class="navcell">
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./screenshots.html" class="menulink">Screenshots</a>
</div>
</div>
And the part of the stylesheet that runs the menu looks like this:
div.navborder1 { border: solid; border-width: medium;
border-color: #890000; width: 150px; position: relative; top: 10px; left: 0px }
div.navcell { border: solid; border-width: thin; border-color: #890000;
border-left: none; border-right: none; border-bottom: none }
a.menulink:link { color: #E6E6E6; font-weight: bold; background-color:
#000000; font-size: 12px; text-decoration: none; display: block;
padding-top: 2px; padding-left: 2px; padding-bottom: 2px }
a.menulink:visited { color: #E6E6E6; font-weight: bold; background-color:
#000000; font-size: 12px; text-decoration: none; display: block;
padding-top: 2px; padding-left: 2px; padding-bottom: 2px }
a.menulink:hover { color: #000000; font-weight: bold; background-color:
#890000; display: block; padding-top: 2px; padding-left: 2px;
padding-bottom: 2px }
a.menulink:active { color: #E6E6E6; font-weight: bold; background-color:
#000000; font-size: 12px; text-decoration: none; display: block;
padding-top: 2px; padding-left: 2px; padding-bottom: 2px }
The problem is this: the hover does not work properly in IE (it works fine in Firefox and Opera). What I want is for the text color to turn black and the background to light up red behind it. All that happens is that the text turns black, but nothing happens to the background. It seems to be because I have the links displaying as blocks. Is there any way to fix this so that it works or to get the same effect without having the links displayed as blocks?Suffering from divitis, classitis and css overkill.
Don't use relative units (medium, thin etc.) for borders. Each browser uses a different value.
This is a list of links, ul would be more semanticly correct.
<style type="text/css">
<!--
div.navborder1 { border: 2px solid #890000; width: 150px; position: relative; top: 10px;}
.navborder1 a { color: #E6E6E6; background:#000;border-top: 1px solid #890000; font-size: 12px; font-weight: bold; text-decoration: none; display: block; padding: 2px 0 2px 2px;}
.navborder1 a:hover { color: #000; background: #890000;}
-->
</style>
</head>
<body>
<div class="navborder1">
<img src=http://www.webdeveloper.com/forum/archive/index.php/"./images/graymenuheader.gif" alt="Menu">
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./index.html">Homepage</a>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./about.html">About the Show</a>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./episodes.html">Episodes</a>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./characters.html">Characters</a>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./screenshots.html">Screenshots</a>
</div>
</body>
</html>
<div class="navborder1">
<img src=http://www.webdeveloper.com/forum/archive/index.php/"./images/graymenuheader.gif" alt="Menu">
<div class="navcell">
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./index.html" class="menulink">Homepage</a>
</div>
<div class="navcell">
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./about.html" class="menulink">About the Show</a>
</div>
<div class="navcell">
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./episodes.html" class="menulink">Episodes</a>
</div>
<div class="navcell">
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./characters.html" class="menulink">Characters</a>
</div>
<div class="navcell">
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./screenshots.html" class="menulink">Screenshots</a>
</div>
</div>
And the part of the stylesheet that runs the menu looks like this:
div.navborder1 { border: solid; border-width: medium;
border-color: #890000; width: 150px; position: relative; top: 10px; left: 0px }
div.navcell { border: solid; border-width: thin; border-color: #890000;
border-left: none; border-right: none; border-bottom: none }
a.menulink:link { color: #E6E6E6; font-weight: bold; background-color:
#000000; font-size: 12px; text-decoration: none; display: block;
padding-top: 2px; padding-left: 2px; padding-bottom: 2px }
a.menulink:visited { color: #E6E6E6; font-weight: bold; background-color:
#000000; font-size: 12px; text-decoration: none; display: block;
padding-top: 2px; padding-left: 2px; padding-bottom: 2px }
a.menulink:hover { color: #000000; font-weight: bold; background-color:
#890000; display: block; padding-top: 2px; padding-left: 2px;
padding-bottom: 2px }
a.menulink:active { color: #E6E6E6; font-weight: bold; background-color:
#000000; font-size: 12px; text-decoration: none; display: block;
padding-top: 2px; padding-left: 2px; padding-bottom: 2px }
The problem is this: the hover does not work properly in IE (it works fine in Firefox and Opera). What I want is for the text color to turn black and the background to light up red behind it. All that happens is that the text turns black, but nothing happens to the background. It seems to be because I have the links displaying as blocks. Is there any way to fix this so that it works or to get the same effect without having the links displayed as blocks?Suffering from divitis, classitis and css overkill.
Don't use relative units (medium, thin etc.) for borders. Each browser uses a different value.
This is a list of links, ul would be more semanticly correct.
<style type="text/css">
<!--
div.navborder1 { border: 2px solid #890000; width: 150px; position: relative; top: 10px;}
.navborder1 a { color: #E6E6E6; background:#000;border-top: 1px solid #890000; font-size: 12px; font-weight: bold; text-decoration: none; display: block; padding: 2px 0 2px 2px;}
.navborder1 a:hover { color: #000; background: #890000;}
-->
</style>
</head>
<body>
<div class="navborder1">
<img src=http://www.webdeveloper.com/forum/archive/index.php/"./images/graymenuheader.gif" alt="Menu">
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./index.html">Homepage</a>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./about.html">About the Show</a>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./episodes.html">Episodes</a>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./characters.html">Characters</a>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"./screenshots.html">Screenshots</a>
</div>
</body>
</html>