我有一个下拉菜单,它似乎只在 IE9 及更低版本处于怪癖模式时才有效。我没有宣布任何高度。如果声明了宽度,则将其设置为 100% 或自动。
在标准模式下,菜单会出现,但只有最顶部是可见的,因为它被其父容器截断。
HTML
<div id="secondary-nav" class="nav" role="toolbar" aria-label="User Tools">
<div class="wrapper">
<ul class="group">
<li><a href="">1</a></li>
<li><a href="">2</a></li>
<li><a href="">3</a></li>
<li><a href="">4</a></li>
<li><a href="">4</a></li>
<li><a href="">5</a></li>
</ul>
</div><!-- /.wrapper -->
</div><!-- /#secondary-nav -->
<div id="page-top" class="group">
<div class="wrapper">
<div id="branding" class="hgroup group">
<h1 class="logo"><a href="/">Logo</a></h1>
</div>
<div id="menu-button"></div>
<div id="global-nav" class="nav" role="navigation" aria-label="Main Site Navigation">
<ul>
<li><a href="">1</a></li>
<li><a href="">2</a></li>
<li><a href="">3</a></li>
<li><a href="">4</a></li>
<li class="expand group">Log-in
<ul class="user-menu sub-nav group" role="menu" aria-label="User Menu">
<li class="user-login group">' . render(drupal_get_form('user_login_block')) . ' ' . fboauth_action_display('connect') . '</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
CSS
/* Header
-------------------------------------------------- */
#page-top {
border-top:2px solid #32568F;
color:#fff;
width:100%;
overflow:visible;
z-index:9999;
background: #000c2d;
background: -moz-linear-gradient(top, #000c2d 0%, #172842 10%, #172842 60%, #193154 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#000c2d), color-stop(10%,#172842), color-stop(60%,#172842), color-stop(100%,#193154));
background: -webkit-linear-gradient(top, #000c2d 0%,#172842 10%,#172842 60%,#193154 100%);
background: -o-linear-gradient(top, #000c2d 0%,#172842 10%,#172842 60%,#193154 100%);
background: -ms-linear-gradient(top, #000c2d 0%,#172842 10%,#172842 60%,#193154 100%);
background: linear-gradient(to bottom, #000c2d 0%,#172842 10%,#172842 60%,#193154 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#000c2d', endColorstr='#193154',GradientType=0 );
}
#page-top .wrapper, #secondary-nav .wrapper { /* Added for old theme consistency, remove! */
max-width: 960px;
}
#branding {
display:block;
padding-top:.9em;
margin-left: .5em;
line-height:2em;
vertical-align:middle;
float: left;
}
#branding h1.logo, .footer-logo {
display:inline-block;
margin:0;
margin-right: .15em;
padding:0;
width:24px;
height:27px;
float:left;
text-indent:100%;
overflow:hidden;
background:url(../images/logo@2x.png) no-repeat left top;
vertical-align:bottom;
background-size: auto 100%;
}
#branding h1.logo a{
display:block;
}
#branding p {
display:block;
font-family:'MuseoSlab','Times New Roman',serif;
font-size:1.2em;
font-weight:500;
float:left;
margin-left:.25em;
padding:0;
color: #fff;
margin: 0;
padding: 0;
}
#branding p a {
color: #fff;
}
#branding p a:hover {
color: #a1c336;
text-decoration: none;
}
a.skip {
position:absolute;
left:-999em;
}
/* Primary Navigation
-------------------------------------------------- */
/* NEW HEADER! */
#global-header * {
box-sizing:border-box;
-moz-box-sizing: border-box;
}
html {
font-size:100%;
}
body {
margin:0 auto;
font:1em/1 Helvetica,Arial,sans-serif;
width:100%;
}
#global-header {
width:100%;
}
.wrapper {
margin:0 auto;
padding: 0 1em;
max-width:960px;
}
.nav ul {
list-style:none;
}
.nav ul > li {
display:block;
float:left;
}
.nav li a {
display:block;
}
[role=toolbar] {
display:block;
margin:0 auto;
width:100%;
background:url(grey_diagnol.png) repeat;
overflow:hidden;
}
[role=toolbar] ul {
display:block;
margin:0 auto;
font-size:.75em;
float:right;
}
[role=toolbar] li {
margin:.5em 0;
}
[role=toolbar] li:not(:last-child) {
border-right:1px solid #436394;
}
[role=toolbar] li a {
color:#436394;
text-decoration:none;
padding:.25em .72em;
}
[role=toolbar] li.citypicker a {
display: inline-block;
padding-left: 0;
}
[role=toolbar] a.ddlocation {
padding-right: .25em;
}
a.choose-location {
font-size: .5em;
color: #efefef;
text-transform: uppercase;
}
[role=toolbar] a:hover {
color:#a1c336;
}
#page-top {
border-top:2px solid #32568F;
background-color:#172842;
color:#fff;
width:100%;
overflow:visible;
z-index: 9999;
}
.fixed {
position: fixed;
top: 0;
box-shadow: 0px 1px 8px #222;
}
#branding {
display:inline;
float:left;
padding-top:.9em;
line-height:2em;
vertical-align:middle;
}
#branding h1.logo {
display:inline-block;
margin:0;
padding:0;
width:124px;
height:27px;
float:left;
text-indent:100%;
overflow:hidden;
background:url(logo.png) no-repeat left top;
vertical-align:bottom;
}
#branding p {
display:block;
font-family:'MuseoSlab500',Georgia,'Times New Roman',serif;
font-size:1.2em;
font-weight:500;
float:left;
margin-left:.25em;
padding:0;
color: #fff;
}
#branding p a {
color: #fff;
}
#branding p a:hover {
color: #a1c336;
text-decoration: none;
}
[role=navigation] ul {
display:block;
margin:0;
padding:0;
float:right;
}
[role=navigation] li {
display:block;
position:relative;
margin-bottom:-5px;
font-family:'MuseoSlab500',Georgia,'Times New Roman',serif;
font-weight:500;
font-size:1.2em;
text-transform:lowercase;
}
[role=navigation] li:hover {
background:#b4df5b;
background:-moz-linear-gradient(top,#a1c336 0%,#88a13d 100%);
background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#a1c336),color-stop(100%,#88a13d));
background:-webkit-linear-gradient(top,#a1c336 0%,#88a13d 100%);
background:-o-linear-gradient(top,#a1c336 0%,#88a13d 100%);
background:-ms-linear-gradient(top,#a1c336 0%,#88a13d 100%);
background:linear-gradient(to bottom,#a1c336 0%,#88a13d 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#a1c336',endColorstr='#88a13d',GradientType=0);
box-shadow:0 1px 4px #000;
text-shadow:1px 1px 1px #3D4427;
color:#fff;
}
.expand-hover-js {
background:#b4df5b;
background:-moz-linear-gradient(top,#a1c336 0%,#88a13d 100%);
background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#a1c336),color-stop(100%,#88a13d));
background:-webkit-linear-gradient(top,#a1c336 0%,#88a13d 100%);
background:-o-linear-gradient(top,#a1c336 0%,#88a13d 100%);
background:-ms-linear-gradient(top,#a1c336 0%,#88a13d 100%);
background:linear-gradient(to bottom,#a1c336 0%,#88a13d 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#a1c336',endColorstr='#88a13d',GradientType=0);
box-shadow:0 1px 4px #000;
text-shadow:1px 1px 1px #3D4427;
color:#fff;
}
[role=navigation] a {
color:#fff;
text-decoration:none;
padding:1em;
}
[role=navigation] li.expand a {
vertical-align: bottom;
}
[role=navigation] .user-name {
display: inline-block;
position: relative;
max-width: 16em;
overflow: hidden;
font:.64em Helvetica,Arial,sans-serif;
color:#a2bf39;
text-transform:uppercase;
text-overflow: ellipsis;
text-shadow:none;
vertical-align: baseline;
}
[role=navigation] li:hover .user-name {
color:#172842;
}
.user-name-hover-js {
color:#172842 !important;
}
.message-count {
display: block;
position: absolute;
top: 0;
right: 0;
box-shadow: 0px 1px 4px #222;
border: 1px solid #172940;
border-radius: 50px;
padding: .25em .5em;
background-color: #d52424;
font: .62em Helvetica, Arial, sans-serif;
font-weight: bold;
color: white;
cursor: default;
}
/*
.message-count:hover {
background-color: red;
border: 2px solid white;
box-shadow: 0px 1px 4px white;
}
*/
[role=navigation] li ul.sub-nav {
display:none;
position:absolute;
top:2.7em;
left:-4em;
width: auto;
z-index: 9999;
box-shadow:0 1px 8px rgba(23,40,66,.5);
border-right:1px solid #172842;
border-bottom:1px solid #172842;
border-left:1px solid #172842;
background-color:#ededf4;
overflow: hidden;
}
.sub-nav li {
float:none;
display:block;
font-size:14px;
font-size:.82rem;
font-family:Helvetica,Arial,sans-serif;
font-weight:400;
width: 100%;
margin:0;
text-shadow:none;
position: relative;
}
.sub-nav li:hover {
background:#a1c336;
text-shadow:none;
box-shadow:none;
}
.sub-nav li a {
display: block;
padding:.75em 1em;
color:#172842;
text-transform: none;
}
.sub-nav li a:hover {
color:#fff;
}
.sub-nav li a.has-notify {
display: block;
padding-right: 0;
float: left;
}
.sub-nav li .menu-notify {
display: block;
float: right;
padding:1.5em .5em 0 .5em;
font-size: .72em;
color:#436394;
width: auto;
}
.sub-nav li:hover .menu-notify {
color: #fff;
}
.sub-nav .menu-notify a {
display: inline;
padding: 0;
color:#436394;
}
.sub-nav .menu-notify a:hover {
color:#436394;
text-decoration: underline;
}
/* Login Forms */
.sub-nav li.user-login {
padding: 1em;
display: block;
}
.sub-nav li.user-login:hover,
[role=navigation] li ul.sub-nav li.user-login:hover{
background-color: #ededf4 !important;
background:#ededf4;
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
filter: none;
box-shadow: 0;
text-shadow: 0;
}
.not-front #user-login-form, #user-login {
margin-top: 1em;
}
#user-login {
margin: 1em;
display: block;
overflow: hidden;
padding: .5em;
}
.not-front #user-login-form input, #user-login input {
padding: .5em;
font-size: 1em;
margin-bottom: .5em;
display: block;
width: 100%;
box-sizing: border-box;
-moz-box-sizing: border-box;
}
#user-login-form div, #user-login div {
display: block;
}
.not-front #user-login-form label, #user-login label {
color: #222;
text-transform: none;
display: block;
}
#user-login label {
margin-top: 1em;
}
#user-login .description {
font-size: .75em;
}
.not-front #user-login-form .item-list, #user-login .item-list {
margin: .5em 0;
display: block;
overflow: hidden;
}
.not-front #user-login-form .item-list li, #user-login .item-list li {
padding:0;
font-size: .75em
}
.not-front #user-login-form .item-list a, #user-login .item-list a {
padding: .5em 0 0 0;
}
.not-front #user-login-form .item-list a:hover, #user-login .item-list a:hover {
background-color: #EDEDF4;
color: #A2BF39;
}
.not-front #user-login-form input[type=submit], #user-login input[type=submit] {
background:#a1c336;
background:-moz-linear-gradient(top,#a1c336 0%,#88a13d 100%);
background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#a1c336),color-stop(100%,#88a13d));
background:-webkit-linear-gradient(top,#a1c336 0%,#88a13d 100%);
background:-o-linear-gradient(top,#a1c336 0%,#88a13d 100%);
background:-ms-linear-gradient(top,#a1c336 0%,#88a13d 100%);
background:linear-gradient(to bottom,#a1c336 0%,#88a13d 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#a1c336',endColorstr='#88a13d',GradientType=0);
font:14px MuseoSlab500,Georgia,Times New Roman,serif;
text-shadow:1px 1px 2px #737863;
color:#fff;
padding:.5em 2em;
box-shadow:1px 1px 3px 0 #737863;
border:none;
cursor:pointer;
display: block;
margin: .5em 0;
}
#user-login input {
width: auto;
}
.not-front #user-login-form input[type=submit]:hover, #user-login input[type=submit]:hover {
background: #b9d955;
background: -moz-linear-gradient(top, #b9d955 0%, #a0b858 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b9d955), color-stop(100%,#a0b858));
background: -webkit-linear-gradient(top, #b9d955 0%,#a0b858 100%);
background: -o-linear-gradient(top, #b9d955 0%,#a0b858 100%);
background: -ms-linear-gradient(top, #b9d955 0%,#a0b858 100%);
background: linear-gradient(to bottom, #b9d955 0%,#a0b858 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b9d955', endColorstr='#a0b858',GradientType=0 );
text-shadow:1px 1px 2px #ccc;
text-decoration: none;
}
.not-front a.facebook-action-connect {
background: none !important;
height: 21px;
padding: 0 !important;
width: 89px;
display: block;
float: none !important;
margin-top: 1em !important;
}