problem with z-index on ie6

二次信任 提交于 2019-12-12 05:37:50

问题


Hy,

I run for several hours on a bug ie6, it was not the only one that I was locking it remains only to solve this one and I would finally be quiet.

I have a vertical menu that I built, the problem is that the second level menu does not overlap with that of the first level despite the z-index. Under FF is impeccable, in ie6 it fair.

here is my code, if you could help you relieve me greatly:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <title></title>
  </head>
<style type="text/css">
<!--


* {
    margin: 0;
    padding: 0;
}
div#menu {
    width: 100px;
}
div#menu ul {
    padding: 0;
    width: 100px;
    border: 1px solid green;
    margin: 0px;
    background: yellow url();
    position: absolute;
    z-index: 1;
}

div#menu ul li {
    position: relative;
    list-style: none;
}
div#menu ul ul {
    position: absolute;
    top: 0px;
    left: 10px;
    display: block;
    background: red url();
    z-index: 999;
    border: 1px solid black;
}
div#menu li a {
    text-decoration: none;
}
//-->  

</style>  
  <body>
    <div id="menu">
       <ul>
          <li><a href="">menu 1</a></li>
          <li><a href="">menu 2</a>
             <ul>
                <li><a href="">Sous menu 2.1</a></li>
                <li><a href="">Sous menu 2.2</a></li>
             </ul>
          </li>
          <li><a href="">menu 3</a></li>
          <li><a href="">menu 4</a></li>
          <li><a href="">menu 5</a></li>
       </ul>
    </div>
  </body>
</html>

回答1:


try this plugin: http://docs.jquery.com/Plugins/bgiframe , will work!

usage: $('.your-dropdown-menu').bgiframe();




回答2:


Try this

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <title>Test Case</title>
  </head>
<style type="text/css">
<!--


* {
    margin: 0;
    padding: 0;
}
div#menu {
    width: 100px;
}
div#menu ul {
    padding: 0;
    width: 100px;
    border: 1px solid green;
    margin: 0px;
    background: yellow;
    position: absolute;
    z-index: 1;
}

div#menu ul li {
    list-style: none;
}
div#menu ul ul {
    position: absolute;
    left: 10px;
    display: block;
    background-color: red;
    z-index: 2;
    border: 1px solid black;
}
div#menu li a {
    text-decoration: none;
}
//-->  

</style>  
  <body>
    <div id="menu">
       <ul>
          <li><a href="">menu 1</a></li>
          <li>
             <ul>
                <li><a href="">Sous menu 2.1</a></li>
                <li><a href="">Sous menu 2.2</a></li>
             </ul>
             <a href="">menu 2</a>
          </li>
          <li><a href="">menu 3</a></li>
          <li><a href="">menu 4</a></li>
          <li><a href="">menu 5</a></li>
       </ul>
    </div>
  </body>
</html>



回答3:


ie6 work on position relative more than absolute

    div#menu ul {
        position:relative;
        z-index:0;
    }
   div#menu ul ul{
        z-index:2;
    }

Please check this one



来源:https://stackoverflow.com/questions/3948251/problem-with-z-index-on-ie6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!