Skip to content

Instantly share code, notes, and snippets.

@tommaton
Created September 27, 2013 14:29
Show Gist options
  • Select an option

  • Save tommaton/6729454 to your computer and use it in GitHub Desktop.

Select an option

Save tommaton/6729454 to your computer and use it in GitHub Desktop.
SASS/SCSS mixin for creating a pure CSS triangle
@mixin triangle($size: 10px, $direction: right, $color: #000000) {
width: 0;
height: 0;
@if $direction == 'up' {
border-left: $size solid transparent;
border-right: $size solid transparent;
border-bottom: $size solid $color;
}
@if $direction == 'right' {
border-left: $size solid transparent;
border-right: $size solid transparent;
border-left: $size solid $color;
}
@if $direction == 'down' {
border-left: $size solid transparent;
border-right: $size solid transparent;
border-top: $size solid $color;
}
@if $direction == 'left' {
border-left: $size solid transparent;
border-right: $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