Last active
October 3, 2018 11:47
-
-
Save maxmckenzie/aaeb16b6cb1c8f82d1b4f9723cffefff to your computer and use it in GitHub Desktop.
Legacy sass grid system without flexbox, but also not using floats. Created for a project with IE9 support.
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
<div> | |
<div className="grid-row"> | |
<div className="col _6 col-demo">col _6</div> | |
<div className="col _6 col-demo">col _6</div> | |
</div> | |
<div className="grid-row"> | |
<div className="col _6"> | |
<div className="grid-row"> | |
<div className="col _6 col-demo">nested col _6</div> | |
<div className="col _6 col-demo">nested col _6</div> | |
</div> | |
</div> | |
<div className="col _6 col-demo">col _6</div> | |
</div> | |
<div className="grid-row"> | |
<div className="col _2 col-demo">col _2</div> | |
<div className="col _2 col-demo">col _2</div> | |
<div className="col _2 col-demo">col _2</div> | |
<div className="col _2 col-demo">col _2</div> | |
<div className="col _2 col-demo">col _2</div> | |
<div className="col _2 col-demo">col _2</div> | |
</div> | |
</div> |
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
.grid-row { | |
display:block; | |
width:100%; | |
padding:0; | |
margin:0; | |
box-sizing: border-box; | |
vertical-align:top; | |
.col { | |
display:inline-block; | |
box-sizing: border-box; | |
margin:$grid-gutter / 2; | |
vertical-align:top; | |
&.no-margin-between { | |
margin: 0; | |
} | |
&-demo { | |
background-color:pink; | |
padding:0.5rem; | |
} | |
} | |
.col:first-child { | |
margin-left:0; | |
} | |
@for $i from 1 through $grid-columns { | |
._#{$i}, { | |
width: unquote((100%) + "%"); | |
$multiplier: $i / $grid-columns; | |
width: calc(100% * #{$multiplier} - #{$grid-gutter} * (1 - #{$multiplier})); | |
} | |
._#{$i}:nth-child(#{12 / $i}n) { | |
margin-right:0; | |
} | |
._#{$i}:nth-child(#{12 / $i}n + 1) { | |
margin-left:0; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment