我遇到了4个问题,我目前的代码无法修复(每次我修复它会产生附带问题): http://jsfiddle.net/88zNs/1/
我知道这是一个很大的问题......非常感谢你的帮助
编辑:感谢salsaturion一切几乎已修复http://jsfiddle.net/88zNs/9/剩下的问题是由于浮动,
HTML:
<div id="header">
<div class="logo">Logo</div>
<ul class="drop_menu">
<li><a href='#'>Link 1</a>
<ul>
<li><a href='#'>Sub Link 1</a>
</li>
<li><a href='#'>Sub Link 2</a>
</li>
</ul>
</li>
<li><a href='#'>Link 2</a>
<ul>
<li><a href='#'>Sub Link 1</a>
</li>
<li><a href='#'>Sub Link 2</a>
</li>
<li><a href='#'>Sub Link 3</a>
</li>
<li><a href='#'>Sub Link 4</a>
</li>
</ul>
</li>
<li><a href='#'>Link 3</a>
<ul>
<li><a href='#'>Sub Link 1</a>
</li>
<li><a href='#'>Sub Link 2</a>
</li>
<li><a href='#'>Sub Link 3</a>
</li>
<li><a href='#'>Sub Link 4</a>
</li>
</ul>
</li>
</ul>
</div>
CSS:
#header {
width: 100%;
height: 120px;
background: #fff;
color: #124191;
font-weight: 300;
font-size: 28px;
display: table;
background: #000;
position: fixed;
}
.logo {
background: aqua;
display: table-cell;
vertical-align: middle;
left:0;
height:80px;
}
/* ==========================================================================
Site Navigation
========================================================================== */
/* CSSTerm.com Simple Horizontal DropDown CSS menu */
.drop_menu {
background:red;
padding:0;
margin:0;
list-style-type:none;
height:80px;
right: 0;
display: table;
z-index: 3000;
display: table-cell;
vertical-align: middle;
right: 0;
}
.red {
background:red;
}
.green {
background:green;
height: 60px;
-webkit-transition-duration: 400ms;
-webkit-transition-function: linear;
}
.drop_menu li {
display: table-cell;
vertical-align: middle;
}
.drop_menu li a {
padding:9px 20px;
display:block;
color:#666;
text-decoration:none;
font-size: 15px;
font-weight: 400;
text-transform: uppercase;
}
/* Submenu */
.drop_menu ul {
position:absolute;
left:-9999px;
top:-9999px;
list-style-type:none;
}
.drop_menu li:hover {
position:relative;
background:#5FD367;
}
.drop_menu li:hover ul {
left:0px;
top:30px;
background:#5FD367;
padding:0px;
}
.drop_menu li:hover ul li a {
padding:5px;
display:block;
width:168px;
text-indent:15px;
background-color:#5FD367;
}
.drop_menu li:hover ul li a:hover {
background:#005555;
}
.block {
width:100%;
height: 500px;
}
答案 0 :(得分:1)
快速查看问题2,原因是因为表格单元格。以下应该具有相同的效果,并将div保持为80px的高度:
.logo {
background: aqua;
vertical-align: middle;
line-height: 80px; /* this is set to same height as the div */
left:0;
height:80px;
margin: 20px 0;
}
当我有机会时,会看看其他问题
编辑: 1)看不到问题 - 它们看起来都是一致的 2)如上所述 3和4)添加浮点数:右到.drop_menu li应解决这两个问题