Last active
August 27, 2021 11:21
-
-
Save lunelson/795a1255bb17c489a9d8 to your computer and use it in GitHub Desktop.
Sass reset mixin, for resetting elements
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.3.14) | |
// Compass (v1.0.3) | |
// ---- | |
@mixin reset($type){ | |
$resets: ( | |
ul: ( | |
list-style: none, | |
margin: 0, | |
padding: 0, | |
li: ( | |
margin: 0, | |
padding: 0 | |
) | |
) | |
); | |
@each $prop, $value in map-get($resets, $type) { | |
@if type-of($value) == 'map' { | |
& > #{$prop} { | |
@each $sub-prop, $sub-value in $value { | |
#{$sub-prop}: $sub-value; | |
} | |
} | |
} @else { | |
#{$prop}: $value; | |
} | |
} | |
} | |
.mylist { | |
@include reset(ul); | |
color: blue; | |
} |
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
.mylist { | |
list-style: none; | |
margin: 0; | |
padding: 0; | |
color: blue; | |
} | |
.mylist > li { | |
margin: 0; | |
padding: 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment