Barebones example of a css-only off-screen navigation
Created
May 26, 2016 19:41
-
-
Save C-Rodg/943abaad1379faf979e72d0a7f779016 to your computer and use it in GitHub Desktop.
Off-Screen Navigation
This file contains hidden or 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
<div id="main-nav" class="nav"><ul><li>OFF SCREEN NAV</li><li>Home</li><li>Contact</li><li>Find Us</li></ul></div> | |
<div class="content"> | |
<h1>Off Screen Navigation Example</h1> | |
<h2>This is a dummy example of offcreen navigation</h2> | |
<p><a href="#main-nav">Click To Open</a></p> | |
<p><a href="#">Click to Close</a></p></div> |
This file contains hidden or 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
* { | |
margin: 0; | |
padding: 0; | |
} | |
.nav { | |
width: 0; | |
overflow: hidden; | |
position: fixed; | |
top: 0; | |
left: 0; | |
height: 100%; | |
background: #000; | |
color: #ccc; | |
transition: width .5s ease-in-out; | |
} | |
.content { | |
text-align: center; | |
width: 100%; | |
float: right; | |
background: #ccc; | |
transition: width .5s ease-in-out; | |
} | |
#main-nav:target { | |
width: 20%; | |
} | |
#main-nav:target + .content { | |
width: 80%; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment