Skip to content

Instantly share code, notes, and snippets.

@asha23
Created March 3, 2020 14:10
Show Gist options
  • Save asha23/26809113ec0c11c11ee90800a4247f65 to your computer and use it in GitHub Desktop.
Save asha23/26809113ec0c11c11ee90800a4247f65 to your computer and use it in GitHub Desktop.
Create margins and padding using an scss loop
// Create a load of padding and margin classes
@for $i from 1 through 20 {
.mt-#{$i} {
margin-top:#{$i}rem!important;
}
.mb-#{$i} {
margin-bottom:#{$i}rem!important;
}
.pt-#{$i} {
padding-top:#{$i}rem!important;
}
.pb-#{$i} {
padding-bottom:#{$i}rem!important;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment