Last active
September 27, 2017 17:11
-
-
Save carolina-vallejo/96b44de7d621b7b0550ed2214ff2927f to your computer and use it in GitHub Desktop.
grid system columns subcolumns mixin sass
This file contains hidden or 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
/*--GRID--*/ | |
@mixin columns-blocks($theGutter, $guttername) { | |
.blocks-#{$guttername} { | |
margin-right: 0; | |
margin-left: 0; | |
@include responsive('min', $w-mobile-s) { | |
margin-right: toEm($theGutter * -1); | |
margin-left: toEm($theGutter * -1); | |
} | |
@include cols($theGutter); //---DOBLE | |
} | |
} | |
$fix-factor:1; | |
@mixin cols($theGutter) { | |
@for $i from 2 through 4 { | |
&.colsx#{$i} { | |
.block { | |
padding-right: 0; | |
padding-left: 0; | |
@include responsive('min', $w-mobile) { | |
padding-right: toEm($theGutter); | |
padding-left: toEm($theGutter); | |
} | |
@if $i>3 { | |
@include responsive('min', $w-mobile-s) { | |
width: 100% / 2; | |
} | |
} | |
@include responsive('min', $w-mobile) { | |
width: 100% / $i; | |
} | |
} | |
} | |
} | |
} | |
@mixin grid-system { | |
$decimal: ($row-medium / 10); | |
$porcentaje: ($row-medium * 10%); | |
.full_c { | |
width: 100%; | |
} | |
.row_medium { | |
max-width: toEm($global-width_num * $decimal); | |
width: ($percent-width * $decimal); | |
margin-right: auto; | |
margin-left: auto; | |
@include clean; | |
@include responsive('max', $w-mobile) { | |
width: $porcentaje; | |
} | |
.row_medium { | |
width: 100%; | |
} | |
} | |
.row_c { | |
max-width: $global-width; | |
width: $percent-width; | |
margin-right: auto; | |
margin-left: auto; | |
@include clean; | |
.row_c { | |
width: 100%; | |
max-width: none; | |
} | |
.row_medium { | |
max-width: $porcentaje; | |
width: $porcentaje; | |
.row_medium { | |
width: 100%; | |
max-width: none; | |
} | |
} | |
} ///////////////////// | |
//-----COLUMN | |
div[class*="blocks"] { | |
@include flex; | |
//@include clean; | |
} | |
/*-- GENERALES BLOQUES --*/ | |
.block { | |
position: relative; | |
@include clean; | |
box-sizing: border-box; | |
float: left; | |
width: 100%; | |
margin-bottom: toEm(20); | |
} | |
@include columns-blocks($gutter, 'gutterx1'); | |
@include columns-blocks($gutter*2, 'gutterx2'); | |
@include columns-blocks($gutter/2, 'gutterx05'); | |
/*///////////////////*/ | |
//-----LATERALS | |
$cols: 4; | |
.col-izq, | |
.col-der { | |
width: ((100% / $cols) * ($cols - 1)); | |
box-sizing: border-box; | |
@include responsive('max', $w-mobile) { | |
width: 100%; | |
margin-bottom: toEm(40); | |
} | |
} | |
.col-der { | |
float: right; | |
padding-left: toEm($gutter * 4); | |
@include responsive('max', $w-mobile) { | |
padding: 0; | |
} | |
} | |
.col-izq { | |
float: left; | |
padding-right: toEm($gutter * 4); | |
@include responsive('max', $w-mobile) { | |
padding: 0; | |
} | |
} | |
.col-lateral { | |
box-sizing: border-box; | |
width: (100% / $cols); | |
float: right; | |
@include responsive('max', $w-mobile) { | |
width: 100%; | |
margin-bottom: toEm(40); | |
} | |
&>* { | |
margin-bottom: toEm(90); | |
&:last-child { | |
margin-bottom: 0; | |
} | |
} | |
} | |
} | |
@include grid-system; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment