如何简化这个SCSS边界半径Mixin? - Sass初学者

Jac*_*cob 2 css sass

我有以下SCSS mixin,我可能写了太多多余的东西:

@mixin radius($topleft, $topright: $topleft, $bottomright: $topleft, $bottomleft: $topleft) {

    -moz-border-radius-topleft:     $topleft;
    -moz-border-radius-topright:    $topright;
    -moz-border-radius-bottomright: $bottomright;
    -moz-border-radius-bottomleft:  $bottomleft;
    -webkit-border-radius:          $topleft $topright $bottomright $bottomleft;
    border-radius:                  $topleft $topright $bottomright $bottomleft;

}
Run Code Online (Sandbox Code Playgroud)

请注意,参数可以采用单个值来应用于所有方面,或者全部4个用于自定义.

FDi*_*isk 6

我建议你使用

@import "compass/css3";
@include border-radius(3px);
Run Code Online (Sandbox Code Playgroud)