I'm building a dropdowns menu that appears when hovering the mouse over the title. Although I followed some instruction on w3schools, my code doesn't work and I don't know why and how to fix it. All answers is appreciated. Here is my code:
.dropdown {
display: block;
position: relative;
}
.dropdown-content {
display: none;
width: 100%;
position: absolute;
}
.dropdown:hover .dropdown-content {
display: block;
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="menu">
<h2 class="dropdown">Menu</h2>
<div class="dropdown-content">
<ul>
<li>
<a href="#">Content</a>
</li>
<li>
<a href="#">Content</a>
</li>
<li>
<a href="#">Content</a>
</li>
<li>
<a href="#">Content</a>
</li>
</ul>
</div>
</div>
</body>
</html>