<ul class="sidebar">
<li>Home</li>
<li>Products</li>
<li>Details</li>
<li>Where to buy</li>
<li>Contact</li>
<li>About</li>
</ul>
<input type="checkbox" id="sidebar-btn" class="sidebar-btn" checked/>
<label for="sidebar-btn"></label>
<div class="content">
<h1>Flat CSS Sidebar</h1>
</div>
@import "compass";
@import url(https://fonts.googleapis.com/css?family=Ubuntu:400,500,700,300);
@import url(https://fonts.googleapis.com/css?family=Lobster);
$side-menu-btn-color: #c0392b;
*, *:before, *:after {
padding:0;
margin:0;
}
body {
overflow-x: hidden;
color: #fff;
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
}
body, html {
width:100%;
height:100%;
}
h1 {
font-family: 'Lobster', cursive;
font-weight:300;
font-size: 2.5em;
}
.sidebar-btn {
position: absolute;
clip: rect(0, 0, 0, 0);
}
label[for="sidebar-btn"] {
position: fixed;
left: 15px;
top: 15px;
z-index: 2;
height: 30px;
width: 30px;
cursor: pointer;
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' x='0px' y='0px' width='30px' height='30px' viewBox='0 0 30 30' enable-background='new 0 0 30 30' xml:space='preserve'><rect style='fill:rgb(255,255,255)' width='15' height='3'/><rect style='fill:rgb(255,255,255)' y='8' width='20' height='3'/><rect style='fill:rgb(255,255,255)' y='16' width='25' height='3'/></svg>");
background-size: contain;
}
.sidebar-btn + label, .content {
transition: left 0.1s;
}
.sidebar-btn:checked + label {
left: 245px;
}
.sidebar-btn:checked ~ .content {
left: 230px;
}
.sidebar {
list-style-type: none;
width: 100%;
height: 100%;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 0;
background-color: $side-menu-btn-color;
}
.sidebar li {
background-color: $side-menu-btn-color;
padding:1em;
color: #fff;
width:300px;
font-family: 'Ubuntu', sans-serif;
font-weight:400;
@include transition-property(all);
@include transition-duration(50ms);
@include transition-timing-function(ease-in);
&:hover {
background-color: darken($side-menu-btn-color, 10);
}
}
.content {
min-height: 100%;
min-width: 100%;
background-color: #34495e;
position: relative;
top: 0;
bottom: 100%;
left: 0;
z-index: 1;
padding: 4em;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.