html - Box-shadow on mega drop-down -
html - Box-shadow on mega drop-down -
i have little problem mega drop-down menu's box-shadow. shadow should visible above "second list item", , actual :hover li item should above dropdown box's shadow. tried set different variations of position , z-index properties, can't solve it.
html:
<ul> <li>first list item <div id="sub">sed id dolor nec odio cursus tincidunt. ut tristique nulla odio, vitae ornare ligula tincidunt vitae. sed cursus, erat eleifend bibendum auctor, quam diam pellentesque eros, ut consequat quam erat non ipsum. cras ut ultrices leo. aliquam blandit scelerisque sem @ volutpat.</div> </li> <li>second list item</li> </ul> css:
ul { padding: 0; margin: 0.2em; } ul li { background: orange; width: 175px; height: 22px; display: inline-block; position: relative; transition: .25s ease; padding: 5px; margin 0; cursor: pointer; } ul li #sub { background-color: #222; width: 300px; box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 1); position: absolute; left: 0px; top: 32px; visibility: hidden; opacity: 0; transition: visibility 0.2s ease, opacity 0.2s ease; z-index: -20; padding: 0.7em; color: white; cursor: initial; } li:hover #sub { visibility: visible; opacity: 0.9; transition-delay: 0s; } http://jsfiddle.net/r4xrj/
how solve it? ideas?
as submenu casts shadow on next <li> items, can accomplish aim + css selctor. allow specify negative z-index on next li in markup.
demo
you need add together
ul li:hover + li{ z-index:-2; } and z-index:-1; ul li .sub
full css :
ul { padding: 0; margin: 0.2em; } ul li { background: orange; width: 175px; height: 22px; display: inline-block; position: relative; transition: .25s ease; padding: 5px; margin 0; cursor: pointer; } ul li:hover + li{ z-index:-2; } ul li .sub { background-color: #222; width: 300px; box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 1); position: absolute; left: 0px; top: 32px; visibility: hidden; opacity: 0; transition: visibility 0.2s ease, opacity 0.2s ease; padding: 0.7em; color: white; cursor: initial; z-index:-1; } li:hover .sub { visibility: visible; opacity: 0.9; transition-delay: 0s; } html css html5 css3 drop-down-menu
Comments
Post a Comment