Skip to content

Instantly share code, notes, and snippets.

@nim23
Created June 27, 2014 09:44
Show Gist options
  • Save nim23/ff13ee96fb4a3e4ac729 to your computer and use it in GitHub Desktop.
Save nim23/ff13ee96fb4a3e4ac729 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<!Doctype html>
<html>
<body>
<div class='container'>
<div class='row'>
<h1>Minimal grid framework</h1>
<h3>Features</h3>
<ul>
<li>12 column grid</li>
<li>Swap columns on different breakpoints</li>
<li>On different breakpoints a column can be specified separate width</li>
<li>If no extra small css is defined columns automatically stack</li>
</ul>
</div>
<div class='row column'>
<div class='col-xs-8 col-md-6'>
col-md-6 col-xs-8
</div>
<div class='col-xs-4 col-md-6'>
col-md-6 col-xs-4
</div>
</div>
<div class='row column'>
<div class='col-xs-6 col-md-8'>
col-md-8 col-xs-6
</div>
<div class='col-xs-6 col-md-4'>
col-md-8 col-xs-6
</div>
</div>
<div class='row column'>
<div class='col-md-4'>
col-md-4
</div>
<div class='col-md-8'>
col-md-8
</div>
</div>
<div class='row column'>
<div class='col-xs-5 col-xs-push-7 col-md-6 col-md-push-0'>
col-md-6 col-xs-5
</div>
<div class='col-xs-7 col-xs-pull-5 col-md-6 col-md-pull-0'>
col-md-6 col-xs-7
</div>
</div>
</div>
</div>
</body>
</html>
// ----
// Sass (v3.3.8)
// Compass (v1.0.0.alpha.19)
// ----
//Extract grid framework from bootstrap
//https://github.com/twbs/bootstrap-sass
//Variables
//breakpoint variables
$screen-xs-min: 480px !default;
$screen-sm-min: 768px !default;
$screen-md-min: 992px !default;
$screen-lg-min: 1200px !default;
//grid variables
$grid-columns : 12 !default;
$grid-gutter-width: 30px !default;
@mixin clearfix(){
&:before,
&:after {
content: " ";
display: table;
}
&:after {
clear: both;
}
}
@mixin make-row($gutter: $grid-gutter-width){
margin-left: ($gutter / -2);
margin-right: ($gutter / -2);
@include clearfix();
}
@mixin make-grid-columns($i:1, $list: ".col-xs-#{$i}, .col-sm-#{$i}, .col-md-#{$i}, .col-lg-#{$i}"){
@for $i from(1+1) through $grid-columns{
//concatenate string list i.e .col-xs-1, col-xs-2 into one single string
$list: "#{$list}, .col-xs-#{$i}, .col-sm-#{$i}, .col-md-#{$i}, .col-lg-#{$i}";
}
#{$list}{
position: relative;
min-height: 1px;
padding-left: ($grid-gutter-width / 2);
padding-right: ($grid-gutter-width / 2);
}
}
@mixin float-grid-columns($class, $i:1, $list: ".col-#{$class}-#{$i}"){
@for $i from(1+1) through $grid-columns{
$list: "#{$list}, .col-#{$class}-#{$i}";
}
#{$list}{
float: left;
}
}
@mixin calc-grid-column($index, $class, $type){
@if($type == width) and ($index > 0){
.col-#{$class}-#{$index}{
width: percentage(($index / $grid-columns));
}
}
@if($type == push) and ($index > 0){
.col-#{$class}-push-#{$index}{
left: percentage(($index / $grid-columns));
}
}
@if($type == push) and ($index == 0){
.col-#{$class}-push-0{
left: auto;
}
}
@if($type == pull) and ($index > 0){
.col-#{$class}-pull-#{$index}{
right: percentage(($index / $grid-columns));
}
}
@if($type == pull) and ($index == 0){
.col-#{$class}-pull-0{
right: auto;
}
}
@if($type == offset){
.col-#{$class}-offset-#{$index}{
margin-left: percentage(($index / $grid-columns));
}
}
}
@mixin loop-grid-columns($columns, $class, $type){
@for $i from 0 through $columns {
@include calc-grid-column($i, $class, $type);
}
}
// create grid for specific class
@mixin make-grid($class){
@include float-grid-columns($class);
@include loop-grid-columns($grid-columns, $class, width);
@include loop-grid-columns($grid-columns, $class, pull);
@include loop-grid-columns($grid-columns, $class, push);
@include loop-grid-columns($grid-columns, $class, offset);
}
@include make-grid-columns();
// Extra small grid
@include make-grid(xs);
//small grid
@media (min-width : $screen-sm-min){
@include make-grid(sm);
}
//medium grid
@media (min-width: $screen-md-min){
@include make-grid(md);
}
//large grid
@media (min-width: $screen-lg-min){
@include make-grid(lg);
}
//below styles are presentation based
//they don not concrent themselves with grid framework
*{
box-sizing: border-box;
}
body{
background-color: #E9F0F5;
font-family: sans-serif;
font-weight: bold;
}
.row{
@include make-row($grid-gutter-width);
}
.column [class^=col-]{
padding-top: 10px;
padding-bottom: 10px;
color: white;
background-color: #EB4A33;
border: 1px solid lighten(#EB4A33, 10%);
text-align: center;
}
.container{
padding-top: 2em;
width: 95%;
margin: auto;
}
.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
position: relative;
min-height: 1px;
padding-left: 15px;
padding-right: 15px;
}
.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 {
float: left;
}
.col-xs-1 {
width: 8.33333%;
}
.col-xs-2 {
width: 16.66667%;
}
.col-xs-3 {
width: 25%;
}
.col-xs-4 {
width: 33.33333%;
}
.col-xs-5 {
width: 41.66667%;
}
.col-xs-6 {
width: 50%;
}
.col-xs-7 {
width: 58.33333%;
}
.col-xs-8 {
width: 66.66667%;
}
.col-xs-9 {
width: 75%;
}
.col-xs-10 {
width: 83.33333%;
}
.col-xs-11 {
width: 91.66667%;
}
.col-xs-12 {
width: 100%;
}
.col-xs-pull-0 {
right: auto;
}
.col-xs-pull-1 {
right: 8.33333%;
}
.col-xs-pull-2 {
right: 16.66667%;
}
.col-xs-pull-3 {
right: 25%;
}
.col-xs-pull-4 {
right: 33.33333%;
}
.col-xs-pull-5 {
right: 41.66667%;
}
.col-xs-pull-6 {
right: 50%;
}
.col-xs-pull-7 {
right: 58.33333%;
}
.col-xs-pull-8 {
right: 66.66667%;
}
.col-xs-pull-9 {
right: 75%;
}
.col-xs-pull-10 {
right: 83.33333%;
}
.col-xs-pull-11 {
right: 91.66667%;
}
.col-xs-pull-12 {
right: 100%;
}
.col-xs-push-0 {
left: auto;
}
.col-xs-push-1 {
left: 8.33333%;
}
.col-xs-push-2 {
left: 16.66667%;
}
.col-xs-push-3 {
left: 25%;
}
.col-xs-push-4 {
left: 33.33333%;
}
.col-xs-push-5 {
left: 41.66667%;
}
.col-xs-push-6 {
left: 50%;
}
.col-xs-push-7 {
left: 58.33333%;
}
.col-xs-push-8 {
left: 66.66667%;
}
.col-xs-push-9 {
left: 75%;
}
.col-xs-push-10 {
left: 83.33333%;
}
.col-xs-push-11 {
left: 91.66667%;
}
.col-xs-push-12 {
left: 100%;
}
.col-xs-offset-0 {
margin-left: 0%;
}
.col-xs-offset-1 {
margin-left: 8.33333%;
}
.col-xs-offset-2 {
margin-left: 16.66667%;
}
.col-xs-offset-3 {
margin-left: 25%;
}
.col-xs-offset-4 {
margin-left: 33.33333%;
}
.col-xs-offset-5 {
margin-left: 41.66667%;
}
.col-xs-offset-6 {
margin-left: 50%;
}
.col-xs-offset-7 {
margin-left: 58.33333%;
}
.col-xs-offset-8 {
margin-left: 66.66667%;
}
.col-xs-offset-9 {
margin-left: 75%;
}
.col-xs-offset-10 {
margin-left: 83.33333%;
}
.col-xs-offset-11 {
margin-left: 91.66667%;
}
.col-xs-offset-12 {
margin-left: 100%;
}
@media (min-width: 768px) {
.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
float: left;
}
.col-sm-1 {
width: 8.33333%;
}
.col-sm-2 {
width: 16.66667%;
}
.col-sm-3 {
width: 25%;
}
.col-sm-4 {
width: 33.33333%;
}
.col-sm-5 {
width: 41.66667%;
}
.col-sm-6 {
width: 50%;
}
.col-sm-7 {
width: 58.33333%;
}
.col-sm-8 {
width: 66.66667%;
}
.col-sm-9 {
width: 75%;
}
.col-sm-10 {
width: 83.33333%;
}
.col-sm-11 {
width: 91.66667%;
}
.col-sm-12 {
width: 100%;
}
.col-sm-pull-0 {
right: auto;
}
.col-sm-pull-1 {
right: 8.33333%;
}
.col-sm-pull-2 {
right: 16.66667%;
}
.col-sm-pull-3 {
right: 25%;
}
.col-sm-pull-4 {
right: 33.33333%;
}
.col-sm-pull-5 {
right: 41.66667%;
}
.col-sm-pull-6 {
right: 50%;
}
.col-sm-pull-7 {
right: 58.33333%;
}
.col-sm-pull-8 {
right: 66.66667%;
}
.col-sm-pull-9 {
right: 75%;
}
.col-sm-pull-10 {
right: 83.33333%;
}
.col-sm-pull-11 {
right: 91.66667%;
}
.col-sm-pull-12 {
right: 100%;
}
.col-sm-push-0 {
left: auto;
}
.col-sm-push-1 {
left: 8.33333%;
}
.col-sm-push-2 {
left: 16.66667%;
}
.col-sm-push-3 {
left: 25%;
}
.col-sm-push-4 {
left: 33.33333%;
}
.col-sm-push-5 {
left: 41.66667%;
}
.col-sm-push-6 {
left: 50%;
}
.col-sm-push-7 {
left: 58.33333%;
}
.col-sm-push-8 {
left: 66.66667%;
}
.col-sm-push-9 {
left: 75%;
}
.col-sm-push-10 {
left: 83.33333%;
}
.col-sm-push-11 {
left: 91.66667%;
}
.col-sm-push-12 {
left: 100%;
}
.col-sm-offset-0 {
margin-left: 0%;
}
.col-sm-offset-1 {
margin-left: 8.33333%;
}
.col-sm-offset-2 {
margin-left: 16.66667%;
}
.col-sm-offset-3 {
margin-left: 25%;
}
.col-sm-offset-4 {
margin-left: 33.33333%;
}
.col-sm-offset-5 {
margin-left: 41.66667%;
}
.col-sm-offset-6 {
margin-left: 50%;
}
.col-sm-offset-7 {
margin-left: 58.33333%;
}
.col-sm-offset-8 {
margin-left: 66.66667%;
}
.col-sm-offset-9 {
margin-left: 75%;
}
.col-sm-offset-10 {
margin-left: 83.33333%;
}
.col-sm-offset-11 {
margin-left: 91.66667%;
}
.col-sm-offset-12 {
margin-left: 100%;
}
}
@media (min-width: 992px) {
.col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {
float: left;
}
.col-md-1 {
width: 8.33333%;
}
.col-md-2 {
width: 16.66667%;
}
.col-md-3 {
width: 25%;
}
.col-md-4 {
width: 33.33333%;
}
.col-md-5 {
width: 41.66667%;
}
.col-md-6 {
width: 50%;
}
.col-md-7 {
width: 58.33333%;
}
.col-md-8 {
width: 66.66667%;
}
.col-md-9 {
width: 75%;
}
.col-md-10 {
width: 83.33333%;
}
.col-md-11 {
width: 91.66667%;
}
.col-md-12 {
width: 100%;
}
.col-md-pull-0 {
right: auto;
}
.col-md-pull-1 {
right: 8.33333%;
}
.col-md-pull-2 {
right: 16.66667%;
}
.col-md-pull-3 {
right: 25%;
}
.col-md-pull-4 {
right: 33.33333%;
}
.col-md-pull-5 {
right: 41.66667%;
}
.col-md-pull-6 {
right: 50%;
}
.col-md-pull-7 {
right: 58.33333%;
}
.col-md-pull-8 {
right: 66.66667%;
}
.col-md-pull-9 {
right: 75%;
}
.col-md-pull-10 {
right: 83.33333%;
}
.col-md-pull-11 {
right: 91.66667%;
}
.col-md-pull-12 {
right: 100%;
}
.col-md-push-0 {
left: auto;
}
.col-md-push-1 {
left: 8.33333%;
}
.col-md-push-2 {
left: 16.66667%;
}
.col-md-push-3 {
left: 25%;
}
.col-md-push-4 {
left: 33.33333%;
}
.col-md-push-5 {
left: 41.66667%;
}
.col-md-push-6 {
left: 50%;
}
.col-md-push-7 {
left: 58.33333%;
}
.col-md-push-8 {
left: 66.66667%;
}
.col-md-push-9 {
left: 75%;
}
.col-md-push-10 {
left: 83.33333%;
}
.col-md-push-11 {
left: 91.66667%;
}
.col-md-push-12 {
left: 100%;
}
.col-md-offset-0 {
margin-left: 0%;
}
.col-md-offset-1 {
margin-left: 8.33333%;
}
.col-md-offset-2 {
margin-left: 16.66667%;
}
.col-md-offset-3 {
margin-left: 25%;
}
.col-md-offset-4 {
margin-left: 33.33333%;
}
.col-md-offset-5 {
margin-left: 41.66667%;
}
.col-md-offset-6 {
margin-left: 50%;
}
.col-md-offset-7 {
margin-left: 58.33333%;
}
.col-md-offset-8 {
margin-left: 66.66667%;
}
.col-md-offset-9 {
margin-left: 75%;
}
.col-md-offset-10 {
margin-left: 83.33333%;
}
.col-md-offset-11 {
margin-left: 91.66667%;
}
.col-md-offset-12 {
margin-left: 100%;
}
}
@media (min-width: 1200px) {
.col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 {
float: left;
}
.col-lg-1 {
width: 8.33333%;
}
.col-lg-2 {
width: 16.66667%;
}
.col-lg-3 {
width: 25%;
}
.col-lg-4 {
width: 33.33333%;
}
.col-lg-5 {
width: 41.66667%;
}
.col-lg-6 {
width: 50%;
}
.col-lg-7 {
width: 58.33333%;
}
.col-lg-8 {
width: 66.66667%;
}
.col-lg-9 {
width: 75%;
}
.col-lg-10 {
width: 83.33333%;
}
.col-lg-11 {
width: 91.66667%;
}
.col-lg-12 {
width: 100%;
}
.col-lg-pull-0 {
right: auto;
}
.col-lg-pull-1 {
right: 8.33333%;
}
.col-lg-pull-2 {
right: 16.66667%;
}
.col-lg-pull-3 {
right: 25%;
}
.col-lg-pull-4 {
right: 33.33333%;
}
.col-lg-pull-5 {
right: 41.66667%;
}
.col-lg-pull-6 {
right: 50%;
}
.col-lg-pull-7 {
right: 58.33333%;
}
.col-lg-pull-8 {
right: 66.66667%;
}
.col-lg-pull-9 {
right: 75%;
}
.col-lg-pull-10 {
right: 83.33333%;
}
.col-lg-pull-11 {
right: 91.66667%;
}
.col-lg-pull-12 {
right: 100%;
}
.col-lg-push-0 {
left: auto;
}
.col-lg-push-1 {
left: 8.33333%;
}
.col-lg-push-2 {
left: 16.66667%;
}
.col-lg-push-3 {
left: 25%;
}
.col-lg-push-4 {
left: 33.33333%;
}
.col-lg-push-5 {
left: 41.66667%;
}
.col-lg-push-6 {
left: 50%;
}
.col-lg-push-7 {
left: 58.33333%;
}
.col-lg-push-8 {
left: 66.66667%;
}
.col-lg-push-9 {
left: 75%;
}
.col-lg-push-10 {
left: 83.33333%;
}
.col-lg-push-11 {
left: 91.66667%;
}
.col-lg-push-12 {
left: 100%;
}
.col-lg-offset-0 {
margin-left: 0%;
}
.col-lg-offset-1 {
margin-left: 8.33333%;
}
.col-lg-offset-2 {
margin-left: 16.66667%;
}
.col-lg-offset-3 {
margin-left: 25%;
}
.col-lg-offset-4 {
margin-left: 33.33333%;
}
.col-lg-offset-5 {
margin-left: 41.66667%;
}
.col-lg-offset-6 {
margin-left: 50%;
}
.col-lg-offset-7 {
margin-left: 58.33333%;
}
.col-lg-offset-8 {
margin-left: 66.66667%;
}
.col-lg-offset-9 {
margin-left: 75%;
}
.col-lg-offset-10 {
margin-left: 83.33333%;
}
.col-lg-offset-11 {
margin-left: 91.66667%;
}
.col-lg-offset-12 {
margin-left: 100%;
}
}
* {
box-sizing: border-box;
}
body {
background-color: #E9F0F5;
font-family: sans-serif;
font-weight: bold;
}
.row {
margin-left: -15px;
margin-right: -15px;
}
.row:before, .row:after {
content: " ";
display: table;
}
.row:after {
clear: both;
}
.column [class^=col-] {
padding-top: 10px;
padding-bottom: 10px;
color: white;
background-color: #EB4A33;
border: 1px solid #f07361;
text-align: center;
}
.container {
padding-top: 2em;
width: 95%;
margin: auto;
}
<!Doctype html>
<html>
<body>
<div class='container'>
<div class='row'>
<h1>Minimal grid framework</h1>
<h3>Features</h3>
<ul>
<li>12 column grid</li>
<li>Swap columns on different breakpoints</li>
<li>On different breakpoints a column can be specified separate width</li>
<li>If no extra small css is defined columns automatically stack</li>
</ul>
</div>
<div class='row column'>
<div class='col-xs-8 col-md-6'>
col-md-6 col-xs-8
</div>
<div class='col-xs-4 col-md-6'>
col-md-6 col-xs-4
</div>
</div>
<div class='row column'>
<div class='col-xs-6 col-md-8'>
col-md-8 col-xs-6
</div>
<div class='col-xs-6 col-md-4'>
col-md-8 col-xs-6
</div>
</div>
<div class='row column'>
<div class='col-md-4'>
col-md-4
</div>
<div class='col-md-8'>
col-md-8
</div>
</div>
<div class='row column'>
<div class='col-xs-5 col-xs-push-7 col-md-6 col-md-push-0'>
col-md-6 col-xs-5
</div>
<div class='col-xs-7 col-xs-pull-5 col-md-6 col-md-pull-0'>
col-md-6 col-xs-7
</div>
</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment