Skip to content

Instantly share code, notes, and snippets.

@zastrow
Created August 8, 2019 17:11
Show Gist options
  • Save zastrow/bd1ce9330b57021c4d060f60c2c22dd5 to your computer and use it in GitHub Desktop.
Save zastrow/bd1ce9330b57021c4d060f60c2c22dd5 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
> 1%
last 2 versions
// ----
// libsass (v3.5.4)
// ----
@mixin positions($top:null, $right:null, $bottom:null, $left:null) {
@if ($top != null and $right == null and $bottom == null and $left == null) {
$top: $top;
$right: $top;
$bottom: $top;
$left: $top;
}
@else if ($top != null and $right != null and $bottom == null and $left == null) {
$top: $top;
$right: $right;
$bottom: $top;
$left: $right;
}
@else if ($top != null and $right != null and $bottom != null and $left == null) {
$top: $top;
$right: $right;
$bottom: $bottom;
$left: $right;
}
@else if ($top != null and $right != null and $bottom != null and $left != null) {
$top: $top;
$right: $right;
$bottom: $bottom;
$left: $left;
}
top: $top;
right: $right;
bottom: $bottom;
left: $left;
}
.example-1 {
position: absolute;
@include positions(1rem);
}
.example-2 {
position: absolute;
@include positions(1rem, 2rem);
}
.example-3 {
position: absolute;
@include positions(1rem, 2rem, 3rem);
}
.example-3 {
position: absolute;
@include positions(1rem, 2rem, 3rem, 4rem);
}
.example-1 {
position: absolute;
top: 1rem;
right: 1rem;
bottom: 1rem;
left: 1rem;
}
.example-2 {
position: absolute;
top: 1rem;
right: 2rem;
bottom: 1rem;
left: 2rem;
}
.example-3 {
position: absolute;
top: 1rem;
right: 2rem;
bottom: 3rem;
left: 2rem;
}
.example-3 {
position: absolute;
top: 1rem;
right: 2rem;
bottom: 3rem;
left: 4rem;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment