css - IE 8 does not keep sub menu open when hovering -


i have navigation menu on site, sub menu on 1 of links. sub menu shown when user hovers on parent level li element.

on modern browsers works perfectly, in internet explorer 8 hovering on li shows sub menu, , hides try select of sub menus elements. means sub menu becomes unusable can't select on it.

i've tried putting sub menu directly underneath li there can no gap between them causing problem persists.

i've put code fiddle can see issue yourself. use embedded link view in ie 8.

fiddle (source): http://jsfiddle.net/2gk5p/3/
embedded (best ie 8 compatibility): http://jsfiddle.net/2gk5p/3/embedded/result/

heres html:

<ul>     <li class="selected"><a href="#">home</a></li>     <li><a href="#">services</a>         <ul class="subnav-wrapper">             <span class="container block">                 <span class="subnav">                     <li><a class="subnav-heading" href="#">header 1</a></li>                     <li><a href="#">sub 1</a></li>                     <li><a href="#">sub 2</a></li>                     <li><a href="#">sub 3</a></li>                 </span>                 <span class="subnav">                     <li><a class="subnav-heading" href="#">header 2</a></li>                     <li><a href="#">sub 1</a></li>                     <li><a href="#">sub 2</a></li>                     <li><a href="#">sub 3</a></li>                 </span>                 <span class="subnav">                     <li><a class="subnav-heading" href="#">header 3</a></li>                     <li><a href="#">sub 1</a></li>                     <li><a href="#">sub 2</a></li>                     <li><a href="#">sub 3</a></li>                 </span>             </span>         </ul>     </li>     <li><a href="#">about</a></li>     <li><a href="#">contact</a></li> </ul> 


, css:

*, *:before, *:after {   -webkit-box-sizing: border-box;   -moz-box-sizing: border-box;   -o-box-sizing: border-box;   -ms-box-sizing: border-box;   box-sizing: border-box; }  ul {     list-style: none; } li {     float: left;     margin: 0 8px; } li:hover {     text-decoration:none; } li:hover .subnav-wrapper {       display: block;  } .subnav-wrapper {   background-color: green;   width: 100%;   position: absolute !important;   padding: 20px 0;   display: none;   top: 36px;   left: 0; } .subnav-wrapper .container {     float: none;  } .subnav {     float: left;     width: 33%;     padding: 0 2%;     position: relative;  } .subnav li {     width: 100%;     float: left;     margin: 0;  } .subnav li {     width: 100%;     float: left;     padding: 5px 10px;  }  .subnav li .subnav-heading {       text-align: center;       padding: 12px 10px;       margin: 0 0 12px;       font-size: 1.2em;       color: white;       background-color: blue;  } 

thanks this!

you have little gap under li , sub menu in ie.

you can fill pseudo element increase area of li : demo

li:after {     content:'';     display:block;     height:8px;     margin-bottom:-8px; } 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -