Created
January 10, 2014 22:51
-
-
Save joshuarule/8364254 to your computer and use it in GitHub Desktop.
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
@mixin triangle($color, $size, $side) { | |
@include pseudo; | |
width: $size; | |
height: $size; | |
@include background-image(linear-gradient(top left, $color, $color 49%, transparent 49%)); | |
@if ($side == "right") { | |
right: 0; | |
top: 50%; | |
margin-top: -$size / 2; | |
@include rotate(135deg); | |
} @else if ($side == "left") { | |
left: -$size; | |
top: 50%; | |
margin-top: -$size / 2; | |
@include rotate(90deg); | |
} @else if ($side == "top") { | |
bottom: -$size / 2 + 1px; | |
right: 50%; | |
margin-right: -$size / 2; | |
@include rotate(45deg); | |
} @else { | |
bottom: -$size / 2 + 1px; | |
right: 50%; | |
margin-right: -$size / 2; | |
@include rotate(-135deg); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment