Trying to practice creating a dropdown. Not sure if this is even the best way, but here's my take on it.
https://jsfiddle.net/dtkreox3/1/
HTML
<ul class="test">
<li class="main"><a href="#">Hover</a>
<ul class="sub">
<li>Link 1</li>
<li>Link 1</li>
<li>Link 1</li>
<li>Link 1</li>
</ul>
</li>
<li class="main"><a href="#">About</a></li>
</ul>
CSS
.test {
border: 1px solid black;
width: 500px;
}
.main {
display: inline-block;
width: 100px;
border: 1px solid black;
}
.sub {
border: 1px solid black;
list-style: none;
width: 50px;
display: none;
}
.main:hover .sub {
display: block;
}
I don't understand why when you hover over the first menu, the "About" gets dropped down. How do I fix this?
also is display: none the best way to hide the content? what about visibility: 0 and opacity: 0?
Thanks