Created
March 17, 2014 15:49
-
-
Save gunnarbittersmann/9601835 to your computer and use it in GitHub Desktop.
responsive menu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* responsive menu | |
*/ | |
#menu | |
{ | |
position: relative; | |
} | |
#menu h2 | |
{ | |
margin: 0; | |
font-size: 1rem; | |
font-weight: normal; | |
} | |
#menu ul | |
{ | |
position: absolute; | |
background: white; | |
display: none; | |
margin: 0; | |
border: 1px solid; | |
padding: 1em; | |
list-style: none; | |
} | |
#menu:hover ul | |
{ | |
display: block; | |
} | |
#menu a | |
{ | |
display: block; | |
text-decoration: none; | |
padding: 1em; | |
} | |
@media screen and (min-width: 20em) | |
{ | |
#menu h2 | |
{ | |
display: none; | |
} | |
#menu ul | |
{ | |
display: block; | |
position: static; | |
} | |
#menu li | |
{ | |
display: inline-block; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<nav id="menu"> | |
<h2 tabindex="0">Menu</h2> | |
<ul> | |
<li><a href="http://example.net/foo">foo</a></li> | |
<li><a href="http://example.net/bar">bar</a></li> | |
<li><a href="http://example.net/baz">baz</a></li> | |
</ul> | |
</nav> | |
<main> | |
<h1>Heading</h1> | |
<p>Here comes the main content.</p> | |
</main> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// alert('Hello world!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment