Skip to content

Instantly share code, notes, and snippets.

@krstivoja
Last active September 21, 2020 17:31
Show Gist options
  • Save krstivoja/ca3fef60b57b603818a4 to your computer and use it in GitHub Desktop.
Save krstivoja/ca3fef60b57b603818a4 to your computer and use it in GitHub Desktop.
Container, Gutter, Breakpoints
.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;
}
}
// ----
// 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