0

我遇到了关于z-index财产的问题absolute在一个ly 定位的 div

这是我的代码:

<nav>
    <li>
      <a href="#">Nav1</a>
      <div class="sub_nav">
        <ul>
          <li><a href="#">SubNav1</a></li>
          <li><a href="#">SubNav2</a></li>
        </ul>
      </div>
    </li>
 </nav>


<div id="tabs">
   <ul>
      <li><a href="#tabs-1">Tab1</a></li>
      <li><a href="#tabs-2">Tab2</a></li>
   </ul>
   <div id="tabs-1">
       sjdhfjdshfjsdhf sdjfhsdjfhsdf jsdhfjsdhfj
   </div>
   <div id="tabs-2">
       jsahdjashdjahsd ajshdjahsdjas jashdjashdjhasjhdja
   </div>
</div>

nav li定位relativesub_nav被定位absolute。列表位于屏幕左侧,选项卡位于屏幕右侧。当我悬停在nav li后面sub_navtabsdiv

这是我的CSS:

.sub_nav{ 
   position: absolute;
   left: 100%;
   top: 0;
   background: #eee;
   width: 200px;
   z-index: 99999
}

z-index里面没有tabsdiv

任何帮助将不胜感激。

4

3 回答 3

1

Apparantly there was a position:relative in the tabs div. I removed that and the problem solved :)

于 2013-09-05T10:13:11.080 回答
0

This is not Z-index problem you put wrong value 'left:100%' in '.sub_nav' replace this in "right:0px;" or as your structure want

this is Fiddle link visit this

于 2013-09-05T06:58:27.400 回答
0

给出 z-index: 99; 到<ul>

于 2013-09-05T06:48:33.263 回答