请忍受我和我对css的无知,但我无法应对这一点。我尝试了Background not showing behind floating divs提供的几个解决方案,但似乎我的情况不同。任何人都可以向我解释为什么列表中的背景似乎落后于浮动div?
这是我项目的示例图片
http://www.tinyuploads.com/images/qLFc1f.bmp
好的,这是我的css代码
#nav {
padding:0 15px 5px 6px;
background:url("../design/nav.gif") 0 100% no-repeat;
}
#nav ul {
margin:0;
padding:0;
list-style:none;
position:relative;
display:inline-table
}
#nav ul li {
margin:0;
padding:0;
}
#nav ul li a {
display:block;
float:none;
padding:12px 15px 12px 14px;
background:url("../design/nav-link.gif") 100% 0 repeat-y;
text-decoration:underline;
}
#nav ul li#nav-active a {
font-weight:bold;
text-decoration:none;
}
#nav ul ul {
display: none;
}
#nav ul li:hover > ul {
display: block;
}
#nav ul:after {
content: ""; clear: both; display: block;
}
#nav ul li {
float: left;
}
#nav ul li:hover {
background: #4b545f;
background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
}
#nav ul li:hover a {
color: #fff;
}
#nav ul li a {
color: #757575; text-decoration: none;
}
#nav ul ul {
background: #5f6975; border-radius: 0px; padding: 0;
position: absolute; top: 100%;
}
#nav ul ul li {
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position: relative;
width:150px;
padding:10px 25px 10px 25px;
}
#nav ul ul li a {
/*padding: 15px 40px;*/
color: #fff;
background:none;
padding:0px;
}
#nav ul ul ul {
position: absolute; left: 100%; top:0;
}