我参加这个聚会迟到了,但这是我最终面临类似前景的结果:
小提琴:
https ://jsbin.com/bibokaqumi/1/edit?html,css,output
标记:
<nav>
<ul>
<li>Link One</li>
<li class="sub">Link Two
<ul>
<li>Sub-Link One</li>
<li>Sub-Link Two</li>
</ul>
</li>
<li>Link Three</li>
</ul>
</nav>
CSS3:
nav li {
list-style: none;
}
nav > ul > li {
height: 100px;
padding-right: 50px;
float: left;
}
nav > ul > li.sub {
position: relative;
}
nav > ul > li.sub ul {
position: absolute;
top: 20px;
width: 200px;
visibility: hidden;
}
nav > ul > li.sub ul {
opacity: 0;
transition-property: opacity;
transition-duration: 0.3s;
}
nav > ul > li.sub:hover ul {
opacity: 1;
transition-delay: 0.1s;
visibility: visible;
}