Last active
September 4, 2015 12:27
-
-
Save rocbear/a6c745a2d8b3695eae47 to your computer and use it in GitHub Desktop.
SCSS place something in the four corners of a container
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
$padding: 1em; | |
$positions: ("t", "l"), ("t", "r"), ("b", "r"), ("b", "l"); | |
@each $v, $h in $positions { | |
#{".position-" + $v + $h} { | |
position: absolute; | |
top: if($v == "t", $padding, auto); | |
right: if($h == "r", $padding, auto); | |
bottom: if($v == "b", $padding, auto); | |
left: if($h == "l", $padding, auto); | |
} | |
} | |
/* | |
Outputs: | |
.position-tl { ... | |
.position-tr { ... | |
.position-br { ... | |
.position-bl { ... | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment