Skip to content

Instantly share code, notes, and snippets.

@oozman
Created May 27, 2013 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oozman/5654657 to your computer and use it in GitHub Desktop.
Save oozman/5654657 to your computer and use it in GitHub Desktop.
A simple CSS-only dropdown menu.
.dropdown-menu {
list-style: none;
font-weight: bold;
width: 100%;
position: relative;
z-index: 5;
font-family: Sans-serif;
}
.dropdown-menu li {
float: left;
position: relative;
margin-right: 2px;
}
.dropdown-menu li a:HOVER {
background: #333;
color: #fff;
text-decoration: underline;
}
.dropdown-menu a {
display: block;
font-size: 15px;
font-weight: bolder;
font-family: sans-serif;
background: #333;
color: #fff;
padding: 5px;
}
.dropdown-menu a:hover {
color: #fff;
background: #fafafa;
}
.dropdown-menu ul {
background: #fff;
list-style: none;
position: absolute;
left: -9999px;
}
.dropdown-menu ul li {
float: none;
margin: 0;
}
.dropdown-menu ul a {
white-space: nowrap;
}
.dropdown-menu li:hover ul {
left: 0;
margin: 0;
}
.dropdown-menu li:hover ul a {
text-decoration: none;
}
.dropdown-menu li:hover ul li a:hover {
background: #fafafa;
color: #333;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment