mannieschumpert
4/5/2013 - 7:19 PM

Sass absolute positioning mixin demo

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)