Skip to content

Instantly share code, notes, and snippets.

@kieran23101
Last active December 1, 2017 15:51
Show Gist options
  • Save kieran23101/2b169a8791f3e3923eb835e9f26bd7ad to your computer and use it in GitHub Desktop.
Save kieran23101/2b169a8791f3e3923eb835e9f26bd7ad to your computer and use it in GitHub Desktop.
Mixin for CSS triangles
@mixin arrow($size, $color, $distanceFromLeft, $position, $InsideOrOut) {
&:after {
content: "";
width: 0px;
height: 0px;
border-left: $size solid transparent;
border-right: $size solid transparent;
@if $position == top and $InsideOrOut == inside {
border-top: $size solid $color;
top: 0;
}
@else if $position == top and $InsideOrOut == outside {
border-bottom: $size solid $color;
top: -$size;
}
@else if $position == bottom and $InsideOrOut == inside {
border-bottom: $size solid $color;
bottom: 0;
}
@else if $position == bottom and $InsideOrOut == outside {
border-top: $size solid $color;
bottom: - $size;
}
position: absolute;
left: $distanceFromLeft;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment