Last active
August 29, 2015 14:18
-
-
Save jedfoster/0571ecd5f983eacd7899 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or 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
// ---- | |
// libsass (v3.2.5) | |
// ---- | |
// In response to https://twitter.com/jed_foster/status/582955571428483072 | |
// Notice how this doesn't suck. | |
// Align an object with absolute positioning | |
// Used to align the Big Play Button in the corners or center | |
@mixin absolute-align($align, $margin, $length) { | |
@if ($align == center) { | |
/* Center it horizontally */ | |
left: 50%; | |
margin-left: -$length/2; | |
} | |
@else if ($align == middle) { | |
/* Center it vertically */ | |
top: 50%; | |
margin-top: -$length/2; | |
} | |
@else { | |
#{$align}: $margin; | |
} | |
} | |
.foo { | |
@include absolute-align(middle, 10px, 10px); | |
} | |
This file contains hidden or 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
.foo { | |
/* Center it vertically */ | |
top: 50%; | |
margin-top: -5px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment