Skip to content

Instantly share code, notes, and snippets.

@lunelson
Last active August 27, 2021 11:21
Show Gist options
  • Save lunelson/795a1255bb17c489a9d8 to your computer and use it in GitHub Desktop.
Save lunelson/795a1255bb17c489a9d8 to your computer and use it in GitHub Desktop.
Sass reset mixin, for resetting elements
// ----
// 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;
}
.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