Skip to content

Instantly share code, notes, and snippets.

@andyknapp
Created June 8, 2014 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andyknapp/05e9d188e7ffe798c7f2 to your computer and use it in GitHub Desktop.
Save andyknapp/05e9d188e7ffe798c7f2 to your computer and use it in GitHub Desktop.
Sass mixins for triangles
@mixin rt-triangle($h, $depth, $color, $top: 0, $left: 100%) {
content: '';
display: inline-block;
position: absolute;
top: $top;
left: $left;
width: 0;
height: 0;
border-top: $h/2 solid transparent;
border-left: $h*$depth solid $color;
border-bottom: $h/2 solid transparent;
}
@mixin up-triangle($h, $depth, $color, $top: 0, $right: 100%) {
content: '';
display: inline-block;
position: absolute;
top: $top;
right: $right;
width: 0;
height: 0;
border-left: $h/2 solid transparent;
border-right: $h/2 solid transparent;
border-bottom: $h*$depth solid $color;
}
@mixin down-triangle($h, $depth, $color, $top: 0, $right: 100%) {
content: '';
display: inline-block;
position: absolute;
top: $top;
right: $right;
width: 0;
height: 0;
border-left: $h/2 solid transparent;
border-right: $h/2 solid transparent;
border-top: $h*$depth solid $color;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment