Skip to content

Instantly share code, notes, and snippets.

@mortendk
Created October 15, 2012 10:13
Show Gist options
  • Save mortendk/3891811 to your computer and use it in GitHub Desktop.
Save mortendk/3891811 to your computer and use it in GitHub Desktop.
dropdown css
/*
This will create a dropdown build on clean mean css
*/
/* -- Dropdown Structure ------------------------------------------------------------------ */
.dropdown { position: relative;}
.dropdown a{ display:block;}
.dropdown ul li{ float:left; position:relative; list-style:none;}
/* lvl 2 : hide the ul & bring it back on hover */
.dropdown ul li ul{ left:-99999px; position:absolute; z-index:9999; margin:0; background:transparent;}
.dropdown ul li:hover ul{ left:0;}
.ie7 .dropdown ul li.hover ul{ left:0;}
.dropdown ul ul li{ position:static; float:none;}
.dropdown ul ul a{ white-space:nowrap;}
/* lvl 3 : hide & showx*/
.dropdown ul ul li ul {display: none; background:transparent; }
.dropdown ul ul li:hover ul {display: block; top:auto; }
.ie7 .dropdown ul ul li:hover ul {margin-top:0px}
/* lvl 4 : hide & show the 4th level need a helper class: expanded*/
.dropdown ul ul ul ul li {display: none;}
.dropdown ul ul ul li.expanded:hover ul li {display: block; top:auto;}
.ie7 .dropdown ul ul ul li:hover ul {margin-top:-2px}
.ie7 .dropdown ul ul ul li.expanded:hover ul li {margin-top:-20px;}
/* sensible Defaults › */
.dropdown li li.expanded > a:after{content:" \203A " }
/* lvl 3 */
.dropdown ul ul li a{width: 120px; height: 20px; overflow: hidden;}
.dropdown ul ul li:hover ul{left: 120px; margin-top:-20px;}
/* lvl 4 */
/* -- Dropdown Skin ------------------------------------------------------------------ */
$dropdown-item-width: 150px;
$dropdown-item-height: 24px;
.dropdown li > a{ }
.dropdown > ul > li > ul{
// -moz-box-shadow: 0px 0px 3px rgba(0,0,0,0.9);
//-webkit-box-shadow: 0px 0px 3px rgba(0,0,0,0.3);
// box-shadow: 0px 0px 3px rgba(0,0,0,0.3);
}
/* lvl 1 */
.dropdown ul li > a {}
.dropdown ul li:hover a {}
/* lvl 2*/
.dropdown ul ul li a {}
.dropdown ul ul li a{
font-size:11px;
min-width: 130px;
width: auto;
height: 18px;
background-color: rgba(145, 193, 228, 0.85);
background-color: #91c1e4\9;
padding:2px 10px;
border-top:1px solid #83afd1;
border-bottom:1px solid #A6C7DC;
}
.dropdown ul ul li a:hover{
}
/* lvl 3*/
.dropdown ul ul li:hover ul{left: $dropdown-item-width; margin-top:-$dropdown-item-height; float:none;}
.dropdown ul ul li ul a {width:130px;}
.dropdown ul ul li:hover ul a{}
.dropdown ul ul li ul a:hover{}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment