Last active
April 27, 2018 04:11
-
-
Save kieranmv95/cc4b711f86981469f06bff2d6c674004 to your computer and use it in GitHub Desktop.
Create pure CSS triangles in a matter of seconds with this scss 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
/* | |
Kieran Venison scss mixin | |
[email protected] | |
Example usage: http://codepen.io/Kieranmv95/pen/QNYLvE | |
*/ | |
// Name: Arrow | |
// Params: direction, color, size | |
@mixin arrow($arrow-direction, $arrow-color, $arrow-size){ | |
//Generic settings | |
width: 0; | |
height: 0; | |
display: inline-block; | |
//Arrow main statement | |
@if ($arrow-direction == down){ | |
border-left: $arrow-size solid transparent; | |
border-right: $arrow-size solid transparent; | |
border-top: $arrow-size solid $arrow-color; | |
} @else if ($arrow-direction == up) { | |
border-left: $arrow-size solid transparent; | |
border-right: $arrow-size solid transparent; | |
border-bottom: $arrow-size solid $arrow-color; | |
} @else if ($arrow-direction == left){ | |
border-top: $arrow-size solid transparent; | |
border-bottom: $arrow-size solid transparent; | |
border-right: $arrow-size solid $arrow-color; | |
} @else if ($arrow-direction == right){ | |
border-top: $arrow-size solid transparent; | |
border-bottom: $arrow-size solid transparent; | |
border-left: $arrow-size solid $arrow-color; | |
} | |
} | |
//EXAMPLE USAGE | |
.right {@include arrow('right', orange, 30px);} | |
.down {@include arrow('down',black,30px);} | |
.up {@include arrow('up', blue, 60px);} | |
.left {@include arrow('left',red,10px);} |
Remove all the map rubbish, was over-complicating something that should be simple
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated gist with new map setting and added functional example for you :)