Created
April 2, 2012 23:28
-
-
Save kflorence/2287980 to your computer and use it in GitHub Desktop.
@mixin arrow($color, $width)
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
/* | |
HTML: <img class="arrow" src="<?= $wg->BlankImgUrl ?>" /> | |
SASS: .arrow { @include arrow(); } | |
*/ | |
@mixin arrow($width: 4px, $color: black, $direction: 'down') { | |
border-color: transparent; | |
// Fixes the 'jagged line' problem for modern browsers | |
// See: http://css-tricks.com/snippets/css/css-triangle/#comment-108252 | |
border-color: rgba($color, 0); | |
border-width: $width; | |
// Fixes the 'thin stroke of grey' on border edges in Firefox | |
// See: http://css-tricks.com/snippets/css/css-triangle/#comment-103509 | |
border-style: inset; | |
height: 0; | |
// Center vertically with the surrounding line | |
vertical-align: middle; | |
width: 0; | |
@if ($direction == 'down') { | |
border-bottom: 0; | |
border-top-color: $color; | |
border-top-style: solid; | |
} @else if ($direction == 'left') { | |
border-left: 0; | |
border-right-color: $color; | |
border-right-style: solid; | |
} @else if ($direction == 'right') { | |
border-left-color: $color; | |
border-left-style: solid; | |
border-right: 0; | |
} @else if ($direction == 'up') { | |
border-bottom-color: $color; | |
border-bottom-style: solid; | |
border-top: 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Todo: apply to img only. Don't use classes for directions, use a param.