Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
badass grid
<h1>badass grid</h1>
<div class="row h-200">
<div class="col-2-3">
<div class="module">
<h3>2/3</h3>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est.
Mauris placerat eleifend leo.</p>
</div>
</div>
<div class="col-1-3">
<div class="module">
<h3>1/3</h3>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies</p>
</div>
</div>
</div>
<div class="row">
<div class="col-1-3">
<div class="module">
<h3>1/3</h3>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies</p>
</div>
</div>
<div class="col-2-3">
<div class="module">
<h3>2/3</h3>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est.
Mauris placerat eleifend leo.</p>
</div>
</div>
</div>
<div class="row row-pad">
<div class="col-2-3">
<div class="module">
<h3>2/3 (Opt-in Outside Padding)</h3>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est.
Mauris placerat eleifend leo.</p>
</div>
</div>
<div class="col-1-3">
<div class="module">
<h3>1/3</h3>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam.</p>
</div>
</div>
</div>
<div class="row row-pad">
<div class="col-1-8">
<div class="module">
<h3>1/8</h3>
</div>
</div>
<div class="col-1-8">
<div class="module">
<h3>1/8</h3>
</div>
</div>
<div class="col-1-8">
<div class="module">
<h3>1/8</h3>
</div>
</div>
<div class="col-1-8">
<div class="module">
<h3>1/8</h3>
</div>
</div>
<div class="col-1-8">
<div class="module">
<h3>1/8</h3>
</div>
</div>
<div class="col-1-8">
<div class="module">
<h3>1/8</h3>
</div>
</div>
<div class="col-1-8">
<div class="module">
<h3>1/8</h3>
</div>
</div>
<div class="col-1-8">
<div class="module">
<h3>1/8</h3>
</div>
</div>
</div>
<div class="row row-pad">
<div class="row">
<div class="col-1-4">
<div class="module">
<h3>1/4</h3>
</div>
</div>
<div class="col-1-2">
<div class="module">
<h3>1/2</h3>
</div>
</div>
<div class="col-1-4">
<div class="module">
<h3>1/4</h3>
</div>
</div>
</div>
<div class="row h-150">
<div class="col-1-4">
<div class="module">
<h3>1/4</h3>
</div>
</div>
<div class="col-1-4">
<div class="module">
<h3>1/4</h3>
</div>
</div>
<div class="col-1-4">
<div class="module">
<h3>1/4</h3>
</div>
</div>
<div class="col-1-4">
<div class="module">
<h3>1/4</h3> bla bla bla
</div>
</div>
</div>
</div>
.row, .row * {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.row:before,
.row:after {
content: " ";
display: table;
}
.row:after {
clear: both;
}
.row {
background: white;
margin: 0 0 10px 0;
/* gutter */
}
.row:last-of-type {
margin: 0 0 0 0;
}
.h-100 {
min-height: 100px;
}
.h-150 {
min-height: 150px;
}
.h-200 {
min-height: 200px;
}
[class*='col-'] {
float: left;
padding-right: 10px;
height: 100%;
/* gutter */
}
.row [class*='col-']:last-of-type {
padding-right: 0;
}
.col-2-3 {
width: 66.66%;
}
.col-1-3 {
width: 33.33%;
}
.col-1-2 {
width: 50%;
}
.col-1-4 {
width: 25%;
}
.col-1-8 {
width: 12.5%;
}
.module {
padding: 20px;
background: #eee;
height: 100%;
}
/* Opt-in outside padding */
.row-pad {
padding: 20px 0 20px 20px;
}
.row-pad [class*='col-']:last-of-type {
padding-right: 20px;
}
/* Small screens */
@media (max-width: 1000px) {
[class*='col-'] {
width: 100%;
padding: 0 0 10px 0;
/* gutter */
}
[class*='col-'][class*='col-']:last-of-type {
padding: 0 0 0 0;
}
.row {
padding: 0 0 0 0;
}
.row-pad {
padding: 20px 20px 20px 20px;
}
}
body {
font-family: arial;
padding: 10px 50px 200px;
background-color: grey;
background-size: 300px 300px;
}
h1 {
color: white;
}
h1 em {
color: #666;
font-size: 16px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment