Last active
December 18, 2015 15:19
-
-
Save visioncan/5803865 to your computer and use it in GitHub Desktop.
CSS triangle generator use SCSS
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
/** | |
* CSS triangle generator use SCSS | |
*/ | |
@mixin arrow ($direction: "down", $color: #000, $width: 20px, $height: $width ) { | |
width: 0; | |
height: 0; | |
content: ""; | |
@if $direction == "right" { | |
border-top: $height solid transparent; | |
border-bottom: $height solid transparent; | |
border-left: $width solid $color; | |
}@elseif $direction == "left" { | |
border-top: $height solid transparent; | |
border-bottom: $height solid transparent; | |
border-right: $width solid $color; | |
}@elseif $direction == "top" { | |
border-left: $width solid transparent; | |
border-right: $width solid transparent; | |
border-bottom: $height solid $color; | |
}@elseif $direction == "bottom" { | |
border-left: $width solid transparent; | |
border-right: $width solid transparent; | |
border-top: $height solid $color; | |
}@elseif $direction == "topRight" { | |
border-right: $width solid $color; | |
border-bottom: $height solid transparent; | |
}@elseif $direction == "topLeft" { | |
border-right: $width solid transparent; | |
border-top: $height solid $color; | |
}@elseif $direction == "bottomRight" { | |
border-bottom: $height solid $color; | |
border-left: $width solid transparent; | |
}@elseif $direction == "bottomLeft" { | |
border-top: $height solid transparent; | |
border-left: $width solid $color; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment