Created
October 26, 2012 03:43
-
-
Save roryokane/3956743 to your computer and use it in GitHub Desktop.
Sass snippets – useful mixins that Compass doesn't already define
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
@mixin all-but-first($property, $normal-value, $value-for-first: 0) | |
#{$property}: $normal-value | |
&:first-child | |
#{$property}: $value-for-first | |
@mixin all-but-last($property, $normal-value, $value-for-last: 0) | |
// won't work in IE8 or below; :last-child not supported | |
#{$property}: $normal-value | |
&:last-child | |
#{$property}: $value-for-last | |
// remember that an alternative to these in certain cases is $property: $val1 $val2 | |
@mixin both-vertical($property, $value) | |
#{$property}-top: $value | |
#{$property}-bottom: $value | |
@mixin both-horizontal($property, $value) | |
#{$property}-right: $value | |
#{$property}-left: $value | |
@mixin horizontally-centered-using-margins | |
+both-horizontal(margin, auto) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment