Last active
May 18, 2023 12:41
-
-
Save adetyaz/ff2f8a14f018984978ec80608ed993d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Set the position of the dropdown container to relative */ | |
.dropdown { | |
position: relative; | |
} | |
/* Style the button that will show the dropdown on hover */ | |
.dropdown-btn { | |
background-color: #f1f1f1; | |
color: #333; | |
padding: 10px 20px; | |
border: none; | |
cursor: pointer; | |
} | |
/* Style the dropdown content */ | |
.dropdown-content { | |
position: absolute; | |
display: none; | |
background-color: #f1f1f1; | |
padding: 10px 0; | |
margin: 0; /* Remove any margin to make the dropdown appear directly below the button */ | |
border: none; | |
z-index: 1; | |
} | |
/* Show the dropdown content when the button is hovered */ | |
.dropdown:hover .dropdown-content { | |
display: block; | |
} | |
/* Style the links in the dropdown content */ | |
.dropdown-content li { | |
display: block; | |
color: #333; | |
padding: 10px 20px; | |
text-decoration: none; | |
list-style: none; | |
cursor: pointer; | |
} | |
/* Change the background color of links on hover */ | |
.dropdown-content li:hover { | |
background-color: #ddd; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment