2
我有一個純粹的CSS驅動菜單,有一些IE問題。在IE 8和9中,如果鼠標超出第一項,則下拉會退出。 7中隱藏着其他元素。 (不要太在乎7,但我認爲我也會把它放在那裏)。IE下拉菜單超出第一項
標記遵循這個基本結構。
<nav>
<ul>
<li></li>
<li>
<ul>
<li></li>
</ul>
</li>
</ul>
</nav>
CSS
/* Main Navigation */
nav#main-nav > .menu {
margin: 0;
line-height: 100%;
padding: .4em 0;
overflow: visible;
position: relative;
background: transparent url(../images/bg-element-gradient.png) repeat-x top left; /* Old browsers */
background: -moz-linear-gradient(top, rgba(219,227,236,1) 10%, rgba(255,255,255,1) 50%, rgba(219,227,236,1) 90%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(10%,rgba(219,227,236,1)), color-stop(50%,rgba(255,255,255,1)), color-stop(90%,rgba(219,227,236,1)));
background: -webkit-linear-gradient(top, rgba(219,227,236,1) 10%,rgba(255,255,255,1) 50%,rgba(219,227,236,1) 90%);
background: -o-linear-gradient(top, rgba(219,227,236,1) 10%,rgba(255,255,255,1) 50%,rgba(219,227,236,1) 90%);
background: -ms-linear-gradient(top, rgba(219,227,236,1) 10%,rgba(255,255,255,1) 50%,rgba(219,227,236,1) 90%);
}
nav#main-nav > .menu > li {
padding: 0 1.9%;
line-height: 1.5em;
float: left;
position: relative;
list-style: none;
}
nav#main-nav > .menu > li:not(:last-child) {
border-right: 1px solid #d1d1d1;
}
nav#main-nav > .menu > li.last {
margin-right: 0;
}
/* dropdown */
nav#main-nav > .menu li.expanded:hover > ul {
visibility: visible;
opacity: 100;
-webkit-transition: all 500ms cubic-bezier(0.250, 0.100, 0.250, 1.000);
-moz-transition: all 500ms cubic-bezier(0.250, 0.100, 0.250, 1.000);
-ms-transition: all 500ms cubic-bezier(0.250, 0.100, 0.250, 1.000);
-o-transition: all 500ms cubic-bezier(0.250, 0.100, 0.250, 1.000);
transition: all 500ms cubic-bezier(0.250, 0.100, 0.250, 1.000); /* ease (default) */
}
/* Main-Nav: Level 2 */
nav#main-nav > .menu > li.expanded > ul {
z-index: 100;
list-style: none;
display: block;
margin: 0;
padding: 0;
width: 155px;
position: absolute;
top: 1.6em;
left: 0;
visibility: hidden;
opacity: 0;
min-width: 100%;
border-left: 1px solid #d1d1d1;
border-right: 1px solid #d1d1d1;
border-bottom: 1px solid #d1d1d1;
font-size: .8em;
line-height: 1em;
-webkit-transition: all 500ms cubic-bezier(0.250, 0.100, 0.250, 1.000);
-moz-transition: all 500ms cubic-bezier(0.250, 0.100, 0.250, 1.000);
-ms-transition: all 500ms cubic-bezier(0.250, 0.100, 0.250, 1.000);
-o-transition: all 500ms cubic-bezier(0.250, 0.100, 0.250, 1.000);
transition: all 500ms cubic-bezier(0.250, 0.100, 0.250, 1.000); /* ease (default) */
-webkit-border-bottom-right-radius: 10px;
-webkit-border-bottom-left-radius: 10px;
-moz-border-radius-bottomright: 10px;
-moz-border-radius-bottomleft: 10px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
background: -moz-linear-gradient(top, rgba(255,255,255,0.95) 0%, rgba(219,227,236,0.95) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,0.95)), color-stop(100%,rgba(219,227,236,0.9))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(255,255,255,0.95) 0%,rgba(219,227,236,0.95) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(255,255,255,0.95) 0%,rgba(219,227,236,0.95) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(255,255,255,0.95) 0%,rgba(219,227,236,0.95) 100%); /* IE10+ */
background: linear-gradient(top, rgba(255,255,255,0.95) 0%,rgba(219,227,236,0.95) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e6ffffff', endColorstr='#e6dbe3ec',GradientType=0); /* IE6-9 */
}
nav#main-nav > .menu ul li {
float: none;
margin: 0;
padding: 0;
}
nav#main-nav > .menu > li.expanded > ul > li {
display: block;
padding: 0 0 1em 1.1em;
z-index: 101;
}
nav#main-nav >.menu > li.expanded > ul > li:first-child {
padding-top: 1em;
}
nav#main-nav > .menu > li.expanded > ul > li > a {
width: 100%;
display: block;
padding: 0 1.1em .25em .25em;
}
nav#main-nav > .menu > li:last-child > ul {
position: absolute;
left: -75px;
}
nav#main-nav > .menu:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
html[xmlns] .menu {
display: block;
}
* html .menu {
height: 1%;
}
住看到它,請訪問recognia.com。
不幸的是,沒有。但是,謝謝。我指的是每個菜單中的鏈接。在列表中運行鼠標時,當你比第一個項目下降時,它將會退縮。 – dv8withn8 2012-01-13 21:44:32
新想法:圖層問題,當您通過滑塊時,會檢索菜單 – 2012-01-13 22:50:14