Last active
September 21, 2020 17:31
-
-
Save krstivoja/ca3fef60b57b603818a4 to your computer and use it in GitHub Desktop.
Container, Gutter, Breakpoints
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
.container { | |
padding: 15px; | |
} | |
@media screen and (min-width: 480px) { | |
.container { | |
padding: 30px; | |
} | |
} | |
@media screen and (min-width: 640px) { | |
.container { | |
padding: 50px; | |
} | |
} | |
@media screen and (min-width: 1024px) { | |
.container { | |
padding: 100px; | |
} | |
} |
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.14) | |
// Compass (v1.0.3) | |
// ---- | |
@mixin padding($fs-map, $fs-breakpoints: $breakpoints) { | |
@each $fs-breakpoint, $gutter in $fs-map { | |
@if $fs-breakpoint == null { | |
padding: $gutter; | |
} | |
@else { | |
// If $fs-font-size is a key that exists in | |
// $fs-breakpoints, use the value | |
@if map-has-key($fs-breakpoints, $fs-breakpoint) { | |
$fs-breakpoint: map-get($fs-breakpoints, $fs-breakpoint); | |
} | |
@media screen and (min-width: $fs-breakpoint) { | |
padding: $gutter; | |
} | |
} | |
} | |
} | |
$breakpoints: ( | |
small : 480px, | |
medium: 640px, | |
large : 1024px | |
); | |
$gutter: ( | |
null : 15px, | |
small : 30px, | |
medium: 50px, | |
large : 100px | |
); | |
.container{ | |
@include padding($gutter); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment