Last active
April 26, 2020 15:45
-
-
Save krasenslavov/7d7f307296a6af46887490463481d4e9 to your computer and use it in GitHub Desktop.
Sass mixin to customize containers & columns. Visit blog posts https://bit.ly/3bg4Rqs
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
// _columns.scss | |
@mixin columns($uid: column, $gap: 16px, $columns: 12) { | |
@for $i from 1 through $columns { | |
.#{$uid}-#{$i} { | |
margin: 0 $gap; | |
width: 100% / $columns * $i; | |
} | |
.#{$uid}-offset-#{$i} { | |
margin-left: 100% / $columns * $i; | |
} | |
} | |
.row { | |
margin-left: -$gap; | |
margin-right: -$gap; | |
} | |
} |
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
// _container.scss | |
@mixin container($uid: container, $small: 640px, $medium: 768px, $large: 1024px, $xlarge: 1280px) { | |
$container: ( | |
'': 100%, | |
'-sm': $small, | |
'-md': $medium, | |
'-lg': $large, | |
'-xl': $xlarge, | |
); | |
@each $prop, $value in $container { | |
.#{$uid}#{$prop} { | |
max-width: $value; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment