Hover
Posted: 07 November 2005 07:17 PM   [ Ignore ]
Newbie
Rank
Total Posts:  1
Joined  2005-11-07

I have a two level menu - I want to hover a different color - it works fine on the submenu - but on the main menu it just changes over the words. This is my example:

http://webpages.charter.net/jukoenig/alaarktest/testingindex.htm

This is the code:

<style type=“text/css”>

#csstopmenu, #csstopmenu ul{
padding: 0;
margin: 0;
list-style: none;
}

#csstopmenu li{
float: top;
position: relative;
width: 10em;
}

#csstopmenu li a:hover{
background-image: url(../images/ButtonOvr.jpg);
}

#csstopmenu a{
text-decoration: none;
}

.mainitems{
border: 1px solid black;
border-left-width: 1px;
background-image: url(../images/button.jpg);
}


.headerlinks a{
margin: auto 8px;
font-weight: bold;
color: black;
}

.submenus{
display: none;
width: 10em;
position: absolute;
top: 0em;
left: 10em;
border: 1px solid black;
background-image: url(../images/buttonsub.jpg);

}

.submenus li{
width: 100%;
}

.submenus li a{
display: block;
width: 100%;
font-weight: bold;
color: black;
text-indent: 3px;
}

html>body .submenus li a{ /* non IE browsers */
width: auto;
}

.submenus li a:hover{
border: 1px solid black;
border-left-width: 1px;
background-image: url(../images/ButtonOvrSub.jpg);

}

#csstopmenu li>ul {/* non IE browsers */
top: auto;
left: auto;
}

#csstopmenu li:hover ul, li.over ul {
display: block;
}

html>body #clearmenu{ /* non IE browsers */
height: 3px;
}

</style>

<script type=“text/javascript”>

startMenu = function() {
if (document.all&&document;.getElementById) {
cssmenu = document.getElementById(“csstopmenu”);
for (i=0; i<cssmenu.childNodes.length; i++) {
node = cssmenu.childNodes;
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function(){
this.className=this.className.replace(" over", "")
}
}
}
}
}

if (window.attachEvent)
window.attachEvent(“onload”, startMenu)
else
window.onload=startMenu;

[removed]
<!—TemplateBeginEditable name=“head”—><!—TemplateEndEditable—>
</head>

<body>
<ul id=“csstopmenu”>

<li class=“mainitems” style=“border-left-width: 1px”>
<div class=“headerlinks”>Home</div>
</li>

<li class=“mainitems”>
<div class=“headerlinks”>Sales</div>
<ul class=“submenus”>
<li>Robots</li>
<li>Robot Parts</li>
</ul>
</li>

<li class=“mainitems”>
<div class=“headerlinks”>Repair Motors</div>
<ul class=“submenus”>
<li>Wrist Units</li>
<li>Robots</li>
<li>Teach Pendants</li>
<li>Circuit Boards</li>
</ul>
</li>


<li class=“mainitems”>
<div class=“headerlinks”>Robot Recondition</div>
</li>


<li class=“mainitems”>
<div class=“headerlinks”>[url=”../pages/equipmentwanted.asp”]Equipment
Wanted[/url]</div>
</li>


<li class=“mainitems”>
<div class=“headerlinks”>Contact Us</div>
</li>


<li class=“mainitems”>
<div class=“headerlinks”>Map</div>
</li>

</ul>

<div id=“clearmenu” style=“clear: left”><!—TemplateBeginEditable name=“Body”—>Body<!—TemplateEndEditable—></div>


</body>
</html>

Profile
 
 
Posted: 30 November 2005 04:38 AM   [ Ignore ]   [ # 1 ]
Newbie
Rank
Total Posts:  3
Joined  2005-11-30

.headerlinks a{
margin: auto 8px;
font-weight: bold;
color: black;
}

you can write it as:

.headerlinks a{
margin: 0;
padding:0 8px;
font-weight: bold;
color: black;
display:block;
}

Profile
 
 
   
 
 
‹‹ gaps between images...      Neat CSS Tabs ››