Reputation: 37
I have a css menu that is not working properly in IE7. It works fine in IE8 and all other browsers.
In IE7 the dropdown veers right as image shows.
Here's the menu: http://testsitefree.nfshost.com/
thanks for help.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> test</title>
<style type ="text/css">
#test {
position:absolute;
left:710px;
top:0px;
font-family:tahoma, verdana, arial, helvetica, sans-serif;
font-size:10px;
z-index:200;
}
body { behavior:url(csshover.htc); }
#test .abab {
background:green;
}
#test p a {
color: #000;
text-decoration:underline!important;
}
#test a {
color:#fff;
text-decoration:none;
}
#test a.number {
color:#2f343a;
}
#test p a:hover {
text-decoration: none!important;
}
ul#test {
list-style: none;
padding: 0;
margin: 0;
}
ul#test li a {
display: block;
font-weight: normal;
padding: 1px;
background:#fff;
}
ul#test li a:hover{
background:#2f343a;
color:#fff;
list-style:none;
}
#test li {
float: left;
position: relative;
width: 90px;
text-align: center;
margin-right:0px;
border:0px solid #ccc;
}
ul#test li.current a {
background:#ccc;
}
ul#test li.current a:hover {
background:#ccc;
}
#test li ul {
display: none;
width:90px;
top: 18px;
left: 0;
font-weight: normal;
font-size:9px;
text-align:left;
padding-left:0;
margin-left:0;
position:absolute;
}
ul#test li ul.sub1 li, ul#test li ul.sub2 li, ul#test li ul.sub3 li {
border-width:0px 1px 1px 1px!important;
width:88px;
}
ul#test li ul.sub1 li a.number, ul#test li ul.sub2 li a.number, ul#test li ul.sub3 li a.number {
font-weight: normal!important;
counter-increment:image;
padding-left:20px;
background-image:url(small.jpg);
background-repeat:no-repeat;
}
ul#test li ul.sub1 li.img1 a{
background-position: 0px 0px;
}
ul#test li ul.sub1 li.img2 a{
background-position: 0px -13px;
}
ul#test li ul.sub1 li.img3 a{
background-position: 0px -26px;
}
ul#test li ul.sub1 li.img4 a{
background-position: 0px -39px;
}
ul#test li ul.sub1 li.img5 a{
background-position: 0px -52px;
}
#test li>ul {
top: auto;
left: auto;
}
#test li:hover ul, li.over ul {
display: block;
}
#test .sub1 li, #test .sub2 li, #test .sub3 li {
list-style:none;
text-align:left;
}
</style>
</head>
<body>
<ul id="test">
<li><a class="abab" href="content/testpopular.php" title="Menu">TEST</a>
<ul class="sub1">
<li class="img1"><a class="number" href="#" title="Number1">Number1</a></li>
<li class="img2"><a class="number" href="#" title="Number2">Number2</a></li>
<li class="img3"><a class="number" href="#" title="Number3">Number3</a></li>
<li class="img4"><a class="number" href="#" title="Number4">Number4</a></li>
<li class="img5"><a class="number" href="#" title="Number5">Number5</a></li>
</ul>
</li>
</ul>
</body>
</html>
Upvotes: 0
Views: 1008
Reputation: 271
Set position: relative for #test LI UL instead of position: absolute. This establishes a containing block but on the other side a stacking context that is fake.
Upvotes: 0
Reputation: 632
when you use margin or padding property then add another property with * means create duplicate for margin/padding property and add * before property.
eg.
*padding-left:20;
this property execute only in IE7 so you can give separate value for them.
Upvotes: 1
Reputation: 5895
remove the below css:
#test li > ul {
/*left: auto;*/ /* remove the css rule IE7 will work fine*/
top: auto;
}
SS:
Upvotes: 0