Skip to content

Instantly share code, notes, and snippets.

@mannieschumpert
Last active December 15, 2015 20:58
Show Gist options
  • Save mannieschumpert/5321866 to your computer and use it in GitHub Desktop.
Save mannieschumpert/5321866 to your computer and use it in GitHub Desktop.
Sass absolute positioning mixin demo
// Gist at https://gist.github.com/mannieschumpert/5321866
// Future enhancements: support all four direction attributes (probably needs a different technique to avoid verboseness)
// Sass v3.2.7
=absolute($args: NULL)
position: absolute
@if $args != NULL
#{nth($args, 1)}: nth($args, 2)
@if length($args) == 4
#{nth($args, 3)}: nth($args, 4)
// Example usage
.div1
+absolute
.div2
+absolute(top 5px)
.div3
+absolute(top 5px left 10px)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment