这是非常基本的,我不知道如何使它工作。
当下拉列表锚没有下划线时,如何保持 .selected 类下划线?
的HTML:
<ul id="nav">
<li>
<a href="about.html">about</a>
</li>
<li>
<a href="about.html">about</a>
</li>
<li class="selected">
<a href="work.html">Work</a>
<ul id="second" class="vis">
<li>
<a href="graphicdesign.html">Graphic Design</a>
</li>
<li>
<a href="illustrations.html">Illustrations</a>
</li>
</ul>
</li>
<!-- etcetera -->
CSS:
ul#nav {
position: relative;
margin-left: 0;
padding-left: 0;
display: inline;
}
ul#nav li {
margin-left: 0;
padding: 3px 15px;
list-style: none;
display: inline;
}
ul#nav li.first {
margin-left: 0;
border-left: none;
list-style: none;
display: inline;
}
ul#second {
position: absolute;
right: -57px;
display: none;
}
.selected {
text-decoration: underline;
}
.selected:hover ul#second {
display: block;
}
.selected:hover ul#second li a {
display: block;
}
a {
text-decoration: none;
}