Skip to content

Instantly share code, notes, and snippets.

@minikomi
Created June 11, 2014 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minikomi/812288e06c18a822fdd7 to your computer and use it in GitHub Desktop.
Save minikomi/812288e06c18a822fdd7 to your computer and use it in GitHub Desktop.
Pure css sidebar layout - less
@import "./pure-min.css";
@import "./side-menu.less";
.pure-img-responsive {
max-width: 100%;
height: auto;
}
#layout, #menu, .menu-link {
-webkit-transition: all 0.1s ease-out;
-moz-transition: all 0.1s ease-out;
-ms-transition: all 0.1s ease-out;
-o-transition: all 0.1s ease-out;
transition: all 0.1s ease-out;
}
@menuwidth: 177px;
#layout {
position: relative;
padding-left: 0;
.active {
position: relative;
left: @menuwidth;
#menu {
left: @menuwidth;
width: @menuwidth;
}
.menu-link {
left: @menuwidth;
}
}
}
.content {
margin: 0 auto;
padding: 0 2em;
max-width: 800px;
margin-bottom: 50px;
line-height: 1.6em;
}
.header {
margin: 0;
color: #333;
text-align: center;
padding: 2.5em 2em 0;
border-bottom: 1px solid #eee;
}
.header h1 {
margin: 0.2em 0;
font-size: 3em;
font-weight: 300;
}
.header h2 {
font-weight: 300;
color: #ccc;
padding: 0;
margin-top: 0;
}
.content-subhead {
margin: 50px 0 20px 0;
font-weight: 300;
color: #888;
}
#menu {
margin-left: -@menuwidth; /* "#menu" width */
width: @menuwidth;
position: fixed;
top: 0;
left: 0;
bottom: 0;
z-index: 1000; /* so the menu or its navicon stays above all content */
background: #191818;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
a {
color: #999;
border: none;
padding: 0.6em 0 0.6em 0.6em;
}
.pure-menu, .pure-menu ul {
border: none;
background: transparent;
}
.pure-menu ul, .pure-menu .menu-item-divided {
border-top: 1px solid #333;
li a:hover,
li a:focus {
background: #333;
}
}
.pure-menu-selected, .pure-menu-heading {
background: #1f8dd6;
a {
color: #fff;
}
}
.pure-menu-heading {
font-size: 110%;
color: #fff;
margin: 0;
}
}
.menu-link {
position: fixed;
display: block; /* show this only on small screens */
top: 0;
left: 0; /* "#menu width" */
background: #000;
background: rgba(0,0,0,0.7);
font-size: 10px; /* change this value to increase/decrease button size */
z-index: 10;
width: 2em;
height: auto;
padding: 2.1em 1.6em;
&:hover,
&:focus {
background: #000;
}
span {
position: relative;
display: block;
}
span,
span:before,
span:after {
background-color: #fff;
width: 100%;
height: 0.2em;
}
span:before,
span:after {
position: absolute;
margin-top: -0.6em;
content: " ";
}
span:after {
margin-top: 0.6em;
}
}
@media (min-width: 48em) {
.header,
.content {
padding-left: 2em;
padding-right: 2em;
}
#layout {
padding-left: @menuwidth; /* left col width "#menu" */
left: 0;
}
#menu {
left: @menuwidth;
}
.menu-link {
position: fixed;
left: @menuwidth;
display: none;
}
#layout.active .menu-link {
left: @menuwidth;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment