Skip to content

Instantly share code, notes, and snippets.

@bradpotter
Last active December 20, 2015 20:28
Show Gist options
  • Save bradpotter/6190111 to your computer and use it in GitHub Desktop.
Save bradpotter/6190111 to your computer and use it in GitHub Desktop.
Media Query CSS for Mobile Navigation
/* Mobile Navigation Menu Icon properties */
#mobile-menu-icon {
border-bottom: 1px solid #ddd;
cursor: pointer;
display: block;
padding: 24px 24px;
padding: 2.4rem 2.4rem;
text-align: center;
}
#mobile-menu-icon::before {
color: #eee;
content: 'MENU \2630';
font-weight: bold;
letter-spacing: 1px;
}
#mobile-menu-icon:hover::before {
color: #eee;
content: 'MENU \2637';
}
#mobile-menu-icon:active::before {
color: #fff;
content: 'MENU \2637';
}
/* Hide Mobile Navigation Menu until it's toggled via script */
.menu-mobile {
display: none;
}
/* Mobile Navigation Menu misc properties */
.nav-mobile {
clear: both;
color: #999;
font-family: Lato, sans-serif;
line-height: 1.5;
width: 100%;
z-index: 9999;
}
.nav-mobile .menu-item {
display: block;
text-align: left;
}
.nav-mobile a {
background-color: #f0f0f0;
border-bottom: 1px solid #ccc;
color: #222;
display: block;
padding: 20px 24px;
padding: 2rem 2.4rem;
position: relative;
}
.nav-mobile a:hover,
.nav-mobile .current-menu-item > a,
.nav-mobile .sub-menu .current-menu-item > a:hover {
background-color: #ddd;
color: #222;
}
.nav-mobile .sub-menu .current-menu-item > a {
color: #999;
}
.nav-mobile > .menu-item > a {
text-transform: uppercase;
}
.nav-mobile .sub-menu {
left: 0px;
opacity: 1;
position: relative;
-webkit-transition: opacity .4s ease-in-out;
-moz-transition: opacity .4s ease-in-out;
-ms-transition: opacity .4s ease-in-out;
-o-transition: opacity .4s ease-in-out;
transition: opacity .4s ease-in-out;
width: 100%;
z-index: 99;
}
.nav-mobile .sub-menu a {
background-color: #fff;
border-bottom: 1px solid #ccc;
font-size: 14px;
font-size: 1.4rem;
padding: 18px 30px;
padding: 1.8rem 3rem;
position: relative;
width: 100%;
}
.nav-mobile .sub-menu a::before {
content: "- ";
font-size: 14px;
font-size: 1.4rem;
}
.nav-mobile .sub-menu a:hover {
background-color: #f7f7f7;
}
.nav-mobile .sub-menu li li a {
padding: 18px 40px;
padding: 1.8rem 4rem;
}
.nav-mobile .sub-menu .sub-menu {
margin: 0;
}
.nav-mobile .menu-item:hover {
position: static;
}
.nav-mobile .menu-item:hover > .sub-menu {
left: auto;
opacity: 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment