Skip to content

Instantly share code, notes, and snippets.

@jbroadway
Last active August 29, 2015 14:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbroadway/5d027fddfadabb56aff0 to your computer and use it in GitHub Desktop.
Save jbroadway/5d027fddfadabb56aff0 to your computer and use it in GitHub Desktop.
Minimal Responsive Grid System.
/**
* Minimal Responsive Grid System.
*
* Usage:
*
* <div class="row">
* <div class="unit-75">
* <h1>Body</h1>
* </div>
* <div class="unit-25">
* <h2>Sidebar</h2>
* </div>
* </div>
*
* Updates:
*
* https://gist.github.com/jbroadway/5d027fddfadabb56aff0
*/
*, *:after, *:before {
margin: 0;
padding: 0;
outline: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
/* attribute selector */
[class*='unit-'] {
float: left;
padding: 10px;
}
/* floats last '.unit-' to the right */
[class*='unit-']:last-of-type {
padding-right: 10px;
float: right;
}
/* clearfix */
.row:after, .row-variable:after {
content: "";
display: table;
clear: both;
}
/* widths */
.unit-100 { width: 100%; }
.unit-90 { width: 90%; }
.unit-80 { width: 80%; }
.unit-75 { width: 75%; }
.unit-70 { width: 70%; }
.unit-66 { width: 66.66%; }
.unit-60 { width: 60%; }
.unit-50 { width: 50%; }
.unit-40 { width: 40%; }
.unit-33 { width: 33.33%; }
.unit-30 { width: 30%; }
.unit-25 { width: 25%; }
.unit-20 { width: 20%; }
.unit-10 { width: 10%; }
.unit-5 { width: 5%; }
/* remove padding */
.no-padding { padding: 0; }
/* desktop */
@media (min-width: 992px) {
.row {
width: 992px;
margin: 0px auto 0px auto;
}
}
@media (max-width: 991px) {
.row { width: 100%; }
}
/* tablets */
@media (max-width: 768px) {
.unit-10, .unit-20, .unit-25, .unit-30, .unit-33, .unit-40, .unit-50 {
width: 50%;
max-width 50%;
}
.unit-60, .unit-66, .unit-70, .unit-75, .unit-80, .unit-90, .unit-100 {
width: 100%;
}
.unit-5 {
display: none;
}
}
/* mobile */
@media (max-width: 480px) {
.unit-10, .unit-20, .unit-25, .unit-30, .unit-33, .unit-40, .unit-50,
.unit-60, .unit-66, .unit-70, .unit-75, .unit-80, .unit-90, .unit-100 {
width: 100%;
}
.unit-5 {
display: none;
}
}
/* bottom margins for block elements */
p, h1, h2, h3, h4, h5, h6, ul, ol {
margin-bottom: 0.8em;
}
ul, ol {
margin-left: 16px;
}
img {
border: 0;
max-width: 95%;
}
html, body {
width: 100% !important;
max-width: 100% !important;
overflow-x: hidden !important;
}
/**
* Custom Styles Below
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment