Last active
June 13, 2017 20:38
-
-
Save mynameispj/5383706 to your computer and use it in GitHub Desktop.
SASS mixin to help build CSS triangles (CSS triangle hat-tip to CSS-Tricks: http://css-tricks.com/snippets/css/css-triangle/)
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 css-arrow($color:#000, $size:'5px', $direction:'up') | |
width: 0 | |
height: 0 | |
@if $direction == 'up' | |
border-right: $size solid transparent | |
border-left: $size solid transparent | |
border-bottom: $size solid $color | |
@if $direction == 'down' | |
border-right: $size solid transparent | |
border-left: $size solid transparent | |
border-top: $size solid $color | |
@if $direction == 'right' | |
border-top: $size solid transparent | |
border-bottom: $size solid transparent | |
border-left: $size solid $color | |
@if $direction == 'left' | |
border-top: $size solid transparent | |
border-bottom: $size solid transparent | |
border-right: $size solid $color |
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
.arrow-up | |
+css-arrow(#000,5px,up) | |
.arrow-down | |
+css-arrow(#000,5px,down) | |
.arrow-right | |
+css-arrow(#000,5px,right) | |
.arrow-left | |
+css-arrow(#000,5px,left) |
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
.terribly-disgusting-arrow | |
+css-arrow(blue,20px,right) |
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
.terribly-disgusting-arrow | |
+css-arrow(blue,20px,up) |
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
<div class="arrow-up"></div> | |
<div class="arrow-down"></div> | |
<div class="arrow-right"></div> | |
<div class="arrow-left"></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Useful mixin, thanks for sharing!