| Author: | brentoneill |
|---|---|
| Views Total: | 10,147 views |
| Official Page: | Go to website |
| Last Update: | February 25, 2015 |
| License: | MIT |
Preview:

Description:
A pure CSS implementation of familiar off-canvas side navigation menu that uses CSS3 transitions for the slide animations.
How to use it:
Create a checkbox input with the label for the toggle button.
<input type="checkbox" id="sidebartoggler"> <label class="toggle" for="sidebartoggler">☰</label>
Create the side navigation menu with Html unordered list.
<div class="sidebar">
<ul>
<li>Home</li>
<li>Projects</li>
<li>Clients</li>
<li>Blog</li>
<li>Contact</li>
</ul>
</div>
Wrap your main content into the ‘page-content’ container.
<div class="page-content"> <!---Page content goes here...--> </div>
The CSS for the side navigation menu.
.toggle {
position: fixed;
top: 20px;
right: 0;
bottom: 0;
left: 20px;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
transition: all 0.5s ease;
z-index: 1;
font-size: 30px;
color: black;
width: 30px;
height: 30px;
cursor: pointer;
}
.toggle:hover { color: #29D4E8; }
.sidebar {
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
transition: all 0.5s ease;
position: fixed;
top: 0px;
right: 0;
bottom: 0px;
left: -190px;
width: 120px;
padding: 30px;
background: #333;
color: white;
z-index: 0;
}
.sidebar ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.sidebar li {
text-transform: uppercase;
opacity: .5;
cursor: pointer;
-webkit-transition: all 0.5s ease-in;
-moz-transition: all 0.5s ease-in;
transition: all 0.5s ease-in;
}
.sidebar li:hover {
opacity: 1;
color: #29D4E8;
}The required CSS for the toggle button.
#sidebartoggler { display: none; }
#sidebartoggler:checked + .page-wrapper .sidebar { left: 0px; }
#sidebartoggler:checked + .page-wrapper .toggle { left: 200px; }
#sidebartoggler:checked + .page-wrapper .page-content { padding-left: 200px; }Add transition effects to the main content as you toggle the side navigation menu.
.page-content {
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
transition: all 0.5s ease;
position: relative;
z-index: 0;
width: 50%;
margin: 0 auto;
text-align: center;
color: #333;
}







Thank you very much! This is really usefull, but you forgot to mention about the .page-wrapper which must be just after the checkbox.