Skip to content

Instantly share code, notes, and snippets.

@cxytomo
Created October 14, 2012 08:49
Show Gist options
  • Save cxytomo/3888052 to your computer and use it in GitHub Desktop.
Save cxytomo/3888052 to your computer and use it in GitHub Desktop.
dropdown css(only mouseover)
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 20px;
color: #333;
}
a {
text-decoration: none;
}
.dropdown {
position: relative;
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
/*z-index: 1000;*/
/*display: none;*/
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
list-style: none;
background-color: white;
border: 1px solid #CCC;
border: 1px solid rgba(0, 0, 0, 0.2);
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
}
.dropdown-menu a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 20px;
color: #333;
white-space: nowrap;
}
.dropdown-menu li > a:hover, .dropdown-menu li > a:focus, .dropdown-submenu:hover > a {
color: white;
text-decoration: none;
background-color: #08C;
background-color: #0081C2;
background-image: -moz-linear-gradient(top, #08C, #0077B3);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#08C), to(#0077B3));
background-image: -webkit-linear-gradient(top, #08C, #0077B3);
background-image: -o-linear-gradient(top, #08C, #0077B3);
background-image: linear-gradient(to bottom, #08C, #0077B3);
background-repeat: repeat-x;
/*
filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ff0088cc',
endColorstr='#ff0077b3', GradientType=0);
*/
}
.dropdown-menu .divider {
height: 1px;
margin: 9px 1px;
overflow: hidden;
background-color: #E5E5E5;
border-bottom: 1px solid white;
}
/*::after introduced by HTML5 to distingush between psedu class and psedu elments*/
.dropdown-submenu > a::after {
display: block;
float: right;
width: 0;
height: 0;
margin-top: 5px;
margin-right: -10px;
/*dropdown icon!perfect!!!!!!!!*/
border-color: transparent;
border-left-color: #ccc;
border-style: solid;
border-width: 5px 0 5px 5px;
content: "";
}
.dropdown-submenu:hover > a:after {
border-left-color: #fff;
}
.dropdown-submenu > a:hover::after {
border-left-color: #fff;
}
/*
.dropdown-submenu:hover > .dropdown-menu {
display: block;
}
*/
.dropdown-submenu > .dropdown-menu {
display: none;
top: 80%;
left: 100%;
margin-top: -6px;
margin-left: -1px;
-webkit-border-radius: 0 6px 6px 6px;
-moz-border-radius: 0 6px 6px 6px;
border-radius: 0 6px 6px 6px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment