Created
May 21, 2013 14:56
-
-
Save surefirewebserv/5620440 to your computer and use it in GitHub Desktop.
Awesome Triangle Mixin by krishna yallapanthula
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($color, $size, $direction){ | |
content: ''; | |
display: block; | |
height: 0; | |
width: 0; | |
border: $size solid transparent; | |
@if($direction== 'up'){ | |
border-top: none; | |
border-bottom-color: $color; | |
} | |
@if($direction== 'down'){ | |
border-top-color: $color; | |
border-bottom: none; | |
} | |
@if($direction== 'right'){ | |
border-right: none; | |
border-left-color: $color; | |
} | |
@if($direction== 'left'){ | |
border-right-color: $color; | |
border-left: none; | |
} | |
} | |
writing the scss by using this mixin | |
.red-triangle{ | |
@include triangle(red, 20px, left); | |
} | |
.green-triangle{ | |
@include triangle(#0f0, 100px, down); | |
} | |
.blue-triangle{ | |
@include triangle(rgba(0,0,255,.5), 80px, up); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment