Last active
August 29, 2015 14:05
-
-
Save uhtred/2a3660c43b07d8777fe6 to your computer and use it in GitHub Desktop.
SASS: Triangle Mixin
This file contains hidden or 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( $orientation: 'right', $size: 5px, $color: #000000 ) { | |
width: 0; | |
height: 0; | |
$listH: right, left; | |
$listV: up, down; | |
@if index( $listH, $orientation ) { | |
border-top: $size solid transparent; | |
border-bottom: $size solid transparent; | |
} | |
@if index( $listV, $orientation ) { | |
border-left: $size solid transparent; | |
border-right: $size solid transparent; | |
} | |
@if $orientation == right { | |
border-left-width: $size; | |
border-left-style: solid; | |
} @else if $orientation == left { | |
border-right-width: $size; | |
border-right-style: solid; | |
} @else if $orientation == up { | |
border-bottom-width: $size; | |
border-bottom-style: solid; | |
} @else if $orientation == down { | |
border-top-width: $size; | |
border-top-style: solid; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment