Skip to content

Instantly share code, notes, and snippets.

@alcidesqueiroz
Last active July 29, 2019 09:20
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alcidesqueiroz/323fbf9ebbd9ff1834f7 to your computer and use it in GitHub Desktop.
Save alcidesqueiroz/323fbf9ebbd9ff1834f7 to your computer and use it in GitHub Desktop.
Sass: Mixin to assign the same value to multiple properties at once
@mixin same($values...) {
$length: length($values);
$value: nth($values, $length);
@for $i from 1 to $length {
#{nth($values, $i)}: $value;
}
}
// Usage:
footer {
@include same(top, left, right, bottom, 0);
@include same(height, line-height, 60px);
}
// Output
footer {
top: 0;
left: 0;
right: 0;
bottom: 0;
height: 60px;
line-height: 60px;
}
@felippenardi
Copy link

Show, velho! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment