Sass mixin with if else

后端 未结 5 2039
借酒劲吻你
借酒劲吻你 2021-01-01 13:51

i have the following mixin

@mixin arrows($arrowdirection:\"left\", $arrowsize:\"5px\", $arrowcolor:$navbgblue ) {
            


        
5条回答
  •  迷失自我
    2021-01-01 14:25

    here is working mixin with just 4 lines of code:

    /*
     * Creates CSS triangle
     * direction options: top, right, bottom, left.
     * Example @include cssTriangle(bottom, red, 50px);
     */
    @mixin cssTriangle($direction:left, $color:#89D4E7, $width:34px) {
        $opposite: nth((top,right,bottom,left), index((bottom,left,top,right),$direction));
        border: solid $width transparent;
        border-#{$direction}: none;
        border-#{$opposite}: solid $width $color;
    }
    

提交回复
热议问题