CSS Drop-down menu positioning problem in IE
I've programmed a css dropdown menu that seems to be working correctly in every browser but Internet Explorer (at least in IE7).
Here's a link to a picture of how it looks when it behaves correctly (not enough rep to post pictures yet): http : // img535imageshack.us/i/chromeexample.png/
Here's a link to how it looks in IE: http : // img299.imageshack.us/i/ieexample.png/
If you want to view the whole website, it's at urbanpromise.org
Here's the css menu coding:
.menu{
width: 40em;
height: 2em;
background: #63089C;
float: left;
font-family: helvetica, arial, sans-serif;
}
.menu ul{
list-style: none;
float: left;
padding: .4em .75em;
margin: 0;
text-align: center;
font-weight: bold;
color: white;
}
.menu a{
text-decoration: none;
color: white;
}
.menu ul:hover{
color: black;
background: white;
}
.menu a:hover{
color: black;
background: white;
}
.menu ul ul{
position: absolute;
z-index: 500;
text-align: left;
}
div.menu ul ul{
display: none;
font-weight: normal;
}
div.menu ul li:hover ul{
display: block;
background: #63089C;
border: 0px solid black;
border-width: .125em 0;
}
Thanks in advance for the help.
Edit: Here is the HTML code for the menu:
<div class="menu">
<ul>
<li><a href="index.php?go=home"><span class="h2">Home</span></a></li>
</ul>
<ul>
<li>Information <img src="img/index/dropdown.png" width="13" height="8" alt="dropdown">
<ul>
<li><a href="index.php?go=staffandboard">Staff and Board</a></li>
<li><a href="index.php?go=historyandmission">History and Mission</a></li>
<li><a href="index.php?go=media">Media</a></li>
<!--<li><a href="index.php?go=speakerinfo">Speaker Information</a></li>-->
<li><a href="index.php?go=contactus">Contact Us</a></li>
</ul>
</li>
</ul>
<ul>
<li>Calendars <img src="img/index/dropdown.png" width="13" height="8" alt="dropdown">
<ul>
<li><a href="index.php?go=schoolcalendar">UrbanPromise School</a></li>
<li><a href="index.php?go=programcalendar">Summer/Afterschool</a></li>
<li><a href="index.php?go=supportercalendar">Volunteer/Supporter</a></li>
</ul>
</li>
</ul>
<ul>
<li>Programs <img src="img/index/dropdown.png" width="13" height="8" alt="dropdown">
<ul>
<li><a href="index.php?go=streetleader">StreetLeader</a></li>
<li><a href="index.php?go=afterschool">Afterschool Programs</a></li>
<li><a href="index.php?go=urbanpromiseschool">UrbanPromise School</a></li>
<li><a href="index开发者_Python百科.php?go=summercamps">Summer Camps</a></li>
<li><a href="index.php?go=internship">Internship</a></li>
</ul>
</li>
</ul>
<ul>
<li>Get Involved <img src="img/index/dropdown.png" width="13" height="8" alt="dropdown">
<ul>
<li><a href="index.php?go=donate">Donate</a></li>
<li><a href="index.php?go=volunteer">Volunteer</a></li>
<li><a href="index.php?go=workgroups">Workgroups</a></li>
<li><a href="index.php?go=store">Store</a></li>
</ul>
</li>
</ul>
<ul>
<li><a href="index.php?go=blog"> Blog </a>
</li>
</ul>
</div>
I tried adding display: inline to .menu with no effect, and when I added it to .menu ul or added it to both this was the result in IE7: http://img830.imageshack.us/img830/9855/ieresult.png
Edit #2: SOLUTION: I fixed the problem using someone's project on Google Code that uses javascript to make IE behave like a more standard browser. Here's a link! http: //code.google.com/p/ie7-js/
You probably have either a double margin float bug or a collapsed parent with floats bug.
I'd add display: inline;
to .menu
and/or .menu ul
.
精彩评论