我一直在研究一个下拉导航,我已经接近我喜欢的方式,但是我无法弄清楚如何获取徽标(实际上只是 h1 文本)和标语,以与我的导航对齐。
徽标和标语的 html 是:
<div class="logo grid_5 omega">
<ul>
<li><a href="default.html"><h1>karma.</h1></a></li>
<li><p id="tagline">A stop motion animation</p></li>
</ul>
</div>
到目前为止,它对应的 CSS 是这样的:
/* Header (Logo) -------------------------------------------------- */
.header.grid_12.omega {
margin-top:40px;
box-shadow:0 3px 10px #222;
background:#FFFFFF;
}
.logo.grid_5.omega {
float:left;
}
导航的html是:
<nav class="grid_7 omega">
<ul>
<li><a href="about.html">About</a></li>
<li><a href="design.html">Process</a>
<ul>
<li><a href="#">Models</a></li>
<li><a href="#">Backgrounds</a></li>
<li><a href="#">Animation</a></li>
<li><a href="#">Post-production</a></li>
</ul>
</li>
<li><a href="style.html">Style</a></li>
<li><a href="reflection.html">Reflection</a></li>
</ul>
</div>
</nav>
它的CSS是:
/* 下拉导航 ---------------------------------------- */
nav ul ul {
display:none;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
background: #FFF;
padding: 0 20px;
list-style: none;
position: relative;
display: inline-table;
}
nav ul:after {
content: ""; clear: both; display: block;
}
nav ul li {
float: left;
}
nav ul li:hover {
background: #4b545f;
}
nav ul li:hover a {
color: #fff;
}
nav ul li a {
display: block; padding: 25px 40px;
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;
}
nav ul ul li a {
padding: 15px 40px;
color: #fff;
}
nav ul ul li a:hover {
background: #4b545f;
}
但是,如您所见:它有点偏离: