Created
February 29, 2016 09:11
-
-
Save soerson/4d7841a348c752ba58fc to your computer and use it in GitHub Desktop.
SCSS: tooltip triangle
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($direction, $size: 6px, $color: #222){ | |
| content: ''; | |
| display: block; | |
| position: absolute; | |
| height: 0; width: 0; | |
| @if ($direction == 'up'){ | |
| border-bottom: $size solid $color; | |
| border-left: 1/2*$size solid transparent; | |
| border-right: 1/2*$size solid transparent; | |
| } | |
| @else if ($direction == 'down'){ | |
| border-top: $size solid $color; | |
| border-left: 1/2*$size solid transparent; | |
| border-right: 1/2*$size solid transparent; | |
| } | |
| @else if ($direction == 'left'){ | |
| border-top: 1/2*$size solid transparent; | |
| border-bottom: 1/2*$size solid transparent; | |
| border-right: $size solid $color; | |
| } | |
| @else if ($direction == 'right'){ | |
| border-top: 1/2*$size solid transparent; | |
| border-bottom: 1/2*$size solid transparent; | |
| border-left: $size solid $color; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment