body {
background-color: #FFFFF5;
font-family: Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
#nav {
width: 480px;
float: right;
height: 30px;
border-top: thin solid #000000;
line-height: 0px;
text-align: right;
padding-right: 20px;
}
.navText {
color: #000000;
text-decoration: none;
font-family: Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 17px;
}
#nav ul {
text-align: left;
display: inline;
list-style: none;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
}
#nav ul li {
font: 17px/17px sans-serif;
font-family: Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;
display: inline-block;
position: relative;
cursor: pointer;
padding-top: 7px;
padding-bottom: 7px;
padding-left: 10px;
padding-right: 10px;
}
#nav ul li a:hover {
background: #555;
color: #fffff5;
display: inline-block;
position: relative;
cursor: pointer;
}
#nav ul li:hover {
background: #555;
color: #fffff5;
}
#nav ul li ul {
position: absolute;
top: 30px;
left: 0px;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
width: 160px;
}
#nav ul li:hover ul {
display: block;
opacity: 1;
visibility: visible;
}
#nav ul li ul li {
background: #555;
display: block;
color: #fffff5;
font: 13px sans-serif;
font-family: Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
#nav ul li ul li a {
text-decoration: none;
background: #555;
display: block;
color: #fffff5;
font: 13px sans-serif;
font-family: Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
#nav ul li ul li:hover {
background: #666;
}
#nav ul li ul li:hover a {
background: #666;
}
</style>
<div id="nav">
<ul>
<a href="about.html" class="navText"><li>ABOUT</li></a>
<li>WORKS
<ul>
<li><a href="written.html">Written</a></li>
<li><a href="photos.html">Photography</a></li>
<li><a href="film.html">Film</a></li>
<li><a href="other.html">Other</a></li>
</ul>
</li>
<li>ACHIEVEMENTS
<ul>
<li><a href="skills.html">Skills</a></li>
<li><a href="acad.html">Academic</a></li>
<li><a href="cca.html">Co-Curricular</a></li>
</ul>
</li>
<a href="connect.html" class="navText"><li>CONNECT</li></a>
</ul>
</div>
1: Modify the location of anchor tags with list items:
<a href="about.html" class="navText"><li>ABOUT</li></a>
…
<a href="connect.html" class="navText"><li>CONNECT</li></a>
2: Update the CSS rule for hovering on nested unordered list items:
CSS
#nav ul li ul li:hover {
background: #666;
}
Also, append the following style rule:
#nav ul li ul li:hover a {
background: #666;
}