Skip to content

Instantly share code, notes, and snippets.

@trey
Created May 8, 2015 15:30
Show Gist options
  • Save trey/df5b1638a025e6c874d2 to your computer and use it in GitHub Desktop.
Save trey/df5b1638a025e6c874d2 to your computer and use it in GitHub Desktop.
Sass Triangle Mixin
// https://css-tricks.com/snippets/css/css-triangle/
@mixin triangle ($color: #ccc, $direction: right, $size: 5px) {
height: 0;
width: 0;
@if $direction == up {
border-bottom: $size solid $color;
border-left: $size solid transparent;
border-right: $size solid transparent;
} @else if $direction == right {
border-bottom: $size solid transparent;
border-left: $size solid $color;
border-top: $size solid transparent;
} @else if $direction == down {
border-left: $size solid transparent;
border-right: $size solid transparent;
border-top: $size solid $color;
} @else if $direction == left {
border-bottom: $size solid transparent;
border-right: $size solid $color;
border-top: $size solid transparent;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment