Last active
September 8, 2016 21:17
-
-
Save CarlinCanales/1482af89beb30c2549162ec7b6344ee1 to your computer and use it in GitHub Desktop.
My personal (simple) grid system based on Flexbox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.21) | |
// Compass (v1.0.3) | |
// ---- | |
$gutter: 30px; | |
$columns: 12; | |
$max-width: 1000px; | |
* { | |
box-sizing: border-box; | |
} | |
.row { | |
display: flex; | |
justify-content: space-between; | |
max-width: $max-width; | |
margin: auto; | |
.row { | |
width: 100%; | |
} | |
} | |
[class*="col-"] { | |
padding-right: $gutter / 2; | |
padding-left: $gutter / 2; | |
} | |
@for $i from 1 through $columns { | |
.col-#{$i} { | |
width: ( $i / $columns ) * 100% ; | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
box-sizing: border-box; | |
} | |
.row { | |
display: flex; | |
justify-content: space-between; | |
max-width: 1000px; | |
margin: auto; | |
} | |
.row .row { | |
width: 100%; | |
} | |
[class*="col-"] { | |
padding-right: 15px; | |
padding-left: 15px; | |
} | |
.col-1 { | |
width: 8.33333333%; | |
} | |
.col-2 { | |
width: 16.66666667%; | |
} | |
.col-3 { | |
width: 25%; | |
} | |
.col-4 { | |
width: 33.33333333%; | |
} | |
.col-5 { | |
width: 41.66666667%; | |
} | |
.col-6 { | |
width: 50%; | |
} | |
.col-7 { | |
width: 58.33333333%; | |
} | |
.col-8 { | |
width: 66.66666667%; | |
} | |
.col-9 { | |
width: 75%; | |
} | |
.col-10 { | |
width: 83.33333333%; | |
} | |
.col-11 { | |
width: 91.66666667%; | |
} | |
.col-12 { | |
width: 100%; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div class="row"> | |
<div class="col-12">Carlin</div> | |
</div> | |
<div class="row"> | |
<div class="col-1">Carlin</div> | |
<div class="col-11">Eduardo</div> | |
</div> | |
<div class="row"> | |
<div class="col-2">Carlin</div> | |
<div class="col-10">Eduardo</div> | |
</div> | |
<div class="row"> | |
<div class="col-1">Carlin</div> | |
<div class="col-1">Eduardo</div> | |
<div class="col-1">Canales</div> | |
<div class="col-1">Carlin</div> | |
<div class="col-5"> | |
<div class="row"> | |
<div class="col-6">col 6</div> | |
<div class="col-6">col 6</div> | |
</div> | |
</div> | |
<div class="col-1">Canales</div> | |
<div class="col-1">Carlin</div> | |
</div> | |
<div class="row"> | |
<div class="col-6">Carlin</div> | |
<div class="col-6">Eduardo</div> | |
<div class="col-6">Canales</div> | |
<div class="col-6">Carlin</div> | |
<div class="col-6">Eduardo</div> | |
<div class="col-6">Canales</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment