Last active
October 23, 2017 20:05
-
-
Save Andy-set-studio/769836fc064ea0fff07ef31722ae6356 to your computer and use it in GitHub Desktop.
CSS triangle mixin. Probably best to use SVG these days - but if this floats your boat, I wont judge.
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
@mixin triangle($colour, $size, $direction, $multiplier: 1.5) { | |
width: 0; | |
height: 0; | |
@if ($direction == "up") { | |
border-top: none; | |
border-right: $size solid transparent; | |
border-bottom: ($size * $multiplier) solid $colour; | |
border-left: $size solid transparent; | |
} | |
@elseif ($direction == "right") { | |
border-top: $size solid transparent; | |
border-right: none; | |
border-bottom: $size solid transparent; | |
border-left: ($size * $multiplier) solid $colour; | |
} | |
@elseif ($direction == "down") { | |
border-top: ($size * $multiplier) solid $colour; | |
border-right: $size solid transparent; | |
border-bottom: none; | |
border-left: $size solid transparent; | |
} | |
@elseif ($direction == "left") { | |
border-top: $size solid transparent; | |
border-right: ($size * $multiplier) solid $colour; | |
border-bottom: $size solid transparent; | |
border-left: none; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment