Skip to content

Instantly share code, notes, and snippets.

@10thfloor
Created September 10, 2012 17:23
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 10thfloor/3692289 to your computer and use it in GitHub Desktop.
Save 10thfloor/3692289 to your computer and use it in GitHub Desktop.
CSS Triangle SASS Mixin!
// add this to block level elements to create a nice triangle!
// derived from http://css-tricks.com/snippets/css/css-triangle/
@mixin css_triangle($dir, $size, $color) {
width: 0;
height: 0;
@if $dir == up {
border-left: $size solid transparent;
border-right: $size solid transparent;
border-bottom: $size solid $color;
} @else if $dir == down {
border-left: $size solid transparent;
border-right: $size solid transparent;
border-top: $size solid $color;
} @else if $dir == left {
border-top: $size solid transparent;
border-bottom: $size solid transparent;
border-right: $size solid $color;
} @else if $dir == right {
border-top: $size solid transparent;
border-bottom: $size solid transparent;
border-left: $size solid $color;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment