Example:
<html>
<head>
<style>
/* Style for the dropdown container */
.dropdown {
position: relative;
display: inline-block;
}
/* Style for the dropdown trigger button */
.dropdown-trigger {
background-color: #3498db;
color: #fff;
padding: 10px 20px;
border: none;
cursor: pointer;
}
/* Style for the dropdown menu */
.dropdown-menu {
display: none;
position: absolute;
top: 100%;
left: 0;
background-color: #f4f4f4;
min-width: 160px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
/* Style for dropdown menu items */
.dropdown-menu li {
padding: 10px;
list-style: none;
text-align: center;
}
/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-menu {
display: block;
}
</style>
</head>
<body>
<div class="dropdown">
<button class="dropdown-trigger">Dropdown</button>
<ul class="dropdown-menu">
<li><a href="#">Item 1</a></li>
<li><a href="#">Item 2</a></li>
<li><a href="#">Item 3</a></li>
</ul>
</div>
</body>
</html>
Output: