Last active
December 14, 2015 08:19
-
-
Save jensgro/5056616 to your computer and use it in GitHub Desktop.
Sass-mixin for creating arrows with CSS. This version doesn't take oldIE into account. There is another version which asks for modern browser or oldIE.
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
// adds all necessary items to :before or :after (hence b-a) to create elements with CSS, such as triangles | |
// top, left, bottom, right shall be added directly to the rule | |
// $ba == before or after | |
@mixin b-a($ba:before, $border-width: 10px, $padding: $border-width * 1.5, $border-side: left, $top-position: 0, $position-side: $border-side, $position-side-distance: 0, $border-color: #000) { | |
$seladd : ":"; | |
padding-#{$border-side}: $padding; | |
position: relative; | |
&#{$seladd+$ba} { | |
content: ""; | |
display: block; | |
width: 0; height: 0; | |
border: $border-width solid transparent; | |
border-#{$border-side}-color: $border-color; | |
position: absolute; | |
top: $top-position; | |
#{$position-side}: $position-side-distance; | |
} | |
} | |
.arrow { | |
@include b-a(); | |
display: inline-block; | |
margin-right: 20px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment