IE7,8中的下拉菜单需要fixin'

时间:2010-06-04 15:54:51

标签: javascript css internet-explorer

我在过去让IE玩得很开心方面取得了很大的成功,但我在这里已经很好了。下拉菜单是可见的并且有效,但它有一些边缘/填充问题,无论我尝试使用什么样的条件语句或黑客,它都不会理顺。

示例页面:www.erisdesigns.net

HTML(删除链接以便我发帖):

<div id="wrapper">
<div id="header">
    <ul id="nav">
    <dl class="dropdown">
      <dt id="one-ddheader" onmouseover="ddMenu('one',1)" onmouseout="ddMenu('one',-1)"></dt>
      <dd id="one-ddcontent" onmouseover="cancelHide('one')" onmouseout="ddMenu('one',-1)">
        <ul>
          <li></li>
          <li></li>
          <li></li>
        </ul>
      </dd>
    </dl>
    <dl class="dropdown">
     <dt id="two-ddheader" onmouseover="ddMenu('two',1)" onmouseout="ddMenu('two',-1)"></dt>
      <dd id="two-ddcontent" onmouseover="cancelHide('two')" onmouseout="ddMenu('two',-1)">
        <ul>
          <li></li>
          <li></li>
          <li></li>
        </ul>
      </dd>
   </dl>         
  </ul>
  </div>

CSS:

#nav {
    top:80px;
    width:65%;
    margin-left:600px;
    padding:0;
    background:#999;
    text-align:center;
    list-style:none;
    position:relative;
    z-index:3;
}

.dropdown {float:left; text-align:center; font-size:14px; padding-right:5px; color:#FFF;}
.dropdown dt {width:175px; padding:8px; font-weight:bold; cursor:pointer; background:transparent;}
.dropdown dt:hover {background:transparent; color:#000;}
.dropdown dd {position:absolute; width:175px; display:none; background:transparent; z-index:200; opacity:0;}
.dropdown ul {width:175px; margin-top:23px; list-style:none;}
.dropdown li {display:inline-block; margin-left:-108px; float:left; padding-left:35px; text-align:left;}
.dropdown a, .dropdown a:active, .dropdown a:visited {display:inline-block; padding:5px 0px 10px 15px; color:#CCC; text-decoration:none; background:#999; width:175px; float:left;}
.dropdown a:hover {background:#999; color:#000;}
.dropdown a.menu {background:transparent; width:200px; float:left; text-align:left; color:#FFF;}
.dropdown a.menu:hover {color:#000}

1 个答案:

答案 0 :(得分:0)

Imo太多标记。尝试将<ul id="nav">替换为<div id="nav">,因为您没有使用<li></li>包装任何内容,因此IE可能会遇到一些问题。