Skip to content

Instantly share code, notes, and snippets.

@mmlindeboom
Last active December 13, 2015 18:18
Show Gist options
  • Save mmlindeboom/4954342 to your computer and use it in GitHub Desktop.
Save mmlindeboom/4954342 to your computer and use it in GitHub Desktop.
Compass mixin to create a css arrow. Accepts direction, size, and color arguments
@mixin arrow($direction, $size, $color){
@if unitless($size) {
@warn "Assuming #{$size} to be in pixels or ems";
}
@if $direction == up {
width:0px;
height:0px;
border-left:$size solid transparent;
border-right:$size solid transparent;
border-bottom:$size solid $color;
}@else if $direction == down {
width:0px;
height:0px;
border-left:$size solid transparent;
border-right:$size solid transparent;
border-top:$size solid $color;
}@else if $direction == right {
width:0px;
height:0px;
border-top:$size solid transparent;
border-bottom:$size solid transparent;
border-left:$size solid $color;
}@else if $direction == left {
width:0px;
height:0px;
border-top:$size solid transparent;
border-bottom:$size solid transparent;
border-right:$size solid $color;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment