Skip to content

Instantly share code, notes, and snippets.

@roryokane
Created October 26, 2012 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roryokane/3956743 to your computer and use it in GitHub Desktop.
Save roryokane/3956743 to your computer and use it in GitHub Desktop.
Sass snippets – useful mixins that Compass doesn't already define
@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