Created
May 8, 2015 15:30
-
-
Save trey/df5b1638a025e6c874d2 to your computer and use it in GitHub Desktop.
Sass Triangle Mixin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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