Skip to content

Instantly share code, notes, and snippets.

@juanbrujo
Created December 23, 2015 21:44
Show Gist options
  • Save juanbrujo/af1c6ff254f20af8af1c to your computer and use it in GitHub Desktop.
Save juanbrujo/af1c6ff254f20af8af1c to your computer and use it in GitHub Desktop.
Easy creation of CSS-only directional arrows
// Arrow SCSS Mixin
//
// Easy creation of CSS-only directional arrows
//
// .arrow {
// @include arrow(100px, #f60, up);
// }
@mixin arrow($size: 10px, $color: inherit, $direction: down) {
display: inline-block;
width: 0;
height: 0;
$size: $size/2;
border: $size solid transparent;
@if $direction == down {
$direction: 'top';
} @elseif $direction == up {
$direction: 'bottom';
} @elseif $direction == left {
$direction: 'right';
} @elseif $direction == right {
$direction: 'left';
} @else {
$direction: "top";
}
border-#{$direction}-color: $color;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment