Skip to content

Instantly share code, notes, and snippets.

@jesders
Created June 13, 2017 14:34
Show Gist options
  • Save jesders/963bc446605b34977f5f464c79b6b861 to your computer and use it in GitHub Desktop.
Save jesders/963bc446605b34977f5f464c79b6b861 to your computer and use it in GitHub Desktop.
CSS Triangle Mixin
@mixin borderTrianlge($direction, $size, $color)
{
$trans: $size solid transparent;
$color: $size solid $color;
width: 0;
height: 0;
@if $direction==up or $direction==down
{
border-left: $trans;
border-right: $trans;
border-top: if($direction==up, none, $color);
border-bottom: if($direction==up, $color, none);
}
@elseif $direction==left or $direction==right
{
border-top: $trans;
border-bottom: $trans;
border-left: if($direction==left, none, $color);
border-right: if($direction==left, $color, none);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment