Skip to content

Instantly share code, notes, and snippets.

@drublic
Created September 23, 2012 18:45
Mobile Menu w/o JS
/**
* Mobile Menu w/o JS
*/
.navigation {
display: none;
position: absolute;
top: 53px;
left: 10px;
border-radius: 5px;
background-clip: padding;
background: url(../img/noise.png) #edeae3;
-webkit-filter: drop-shadow(0 0 10px rgba(50,50,0,0.5));
}
.navigation:before, .navigation:after {
content: "";
position: absolute;
}
.navigation:after {
top: -11px; left: 17px;
width: 20px;
height: 20px;
border-radius: 3px 0 0 0;
transform: rotate(45deg);
background: url(../img/noise.png) #edeae3;
}
.navigation:before {
top: -4px; left: 11px;
width: 22px;
height: 0;
border-width: 0 5px 5px 5px;
border-style: solid;
border-color: #edeae3 transparent;
}
.navigation:target {
display: block;
}
/* Menu Buttons */
.menubutton {
display: inline-block;
background: url(../img/noise.png) #edeae3;
padding: .2rem 1rem;
border-radius: 5px;
background-clip: padding;
}
.navigation:target + .menubutton-show {
display: none;
}
.menubutton-hide {
display: none;
}
.navigation:target ~ .menubutton-hide {
display: inline-block;
}
/* Menu styling */
.navigation > ul {
list-style: none;
padding: .75rem 0 .5rem;
margin: 0;
min-width: 200px
}
.navigation a {
display: block;
padding: 3px 1rem;
}
.navigation a:hover {
background: rgba(255,255,255,0.5)
}
/* Generally */
body {
font-family: sans-serif;
}
a {
color: #333;
text-decoration: none;
}
<nav id="navigation" class="navigation">
<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
<li><a href="#">Link 4</a></li>
</ul>
</nav>
<a class="menubutton menubutton-show" href="#navigation">Show Menu</a>
<a class="menubutton menubutton-hide" href="#">Hide Menu</a>
{"view":"split","fontsize":"90","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment