作者:书友16941424_529 | 来源:互联网 | 2023-06-16 22:03
I am using SCSS code for styling my ruby app and am trying to write my own "rounded" mixin to help out with multi-browser border rounding.
我正在使用SCSS代码来设计我的ruby应用程序,并试图编写自己的“圆形”mixin,以帮助实现多浏览器边界的四舍五入。
Currently I have the following:
目前我有以下几点:
@mixin rounded($corner: all , $radius: 8px) {
@if $corner==all || $corner==bottom || $corner == right || $corner==bottom-right{webkit-border-bottom-right-radius: $radius;}
@if $corner==all || $corner==bottom || $corner == left || $corner==bottom-left{-webkit-border-bottom-left-radius: $radius;}
@if $corner==all || $corner==top || $corner == right || $corner==top-right{-webkit-border-top-right-radius: $radius;}
@if $corner==all || $corner==bottom || $corner == left || $corner==top-left{-webkit-border-top-left-radius: $radius;}
@if $corner==all || $corner==bottom || $corner == right || $corner==bottom-right{-khtml-border-radius-bottomright: $radius;}
@if $corner==all || $corner==bottom || $corner == left || $corner==bottom-left{-khtml-border-radius-bottomleft: $radius;}
@if $corner==all || $corner==top || $corner == right || $corner==top-right{-khtml-border-radius-topright: $radius;}
@if $corner==all || $corner==bottom || $corner == left || $corner==top-left{-khtml-border-radius-topleft: $radius;}
@if $corner==all || $corner==bottom || $corner == right || $corner==bottom-right{-moz-border-radius-bottomright: $radius;}
@if $corner==all || $corner==bottom || $corner == left || $corner==bottom-left{-moz-border-radius-bottomleft: $radius;}
@if $corner==all || $corner==top || $corner == right || $corner==top-right{-moz-border-radius-topright: $radius;}
@if $corner==all || $corner==bottom || $corner == left || $corner==top-left{-moz-border-radius-topleft: $radius;}
@if $corner==all || $corner==bottom || $corner == right || $corner==bottom-right{border-bottom-right-radius: $radius;}
@if $corner==all || $corner==bottom || $corner == left || $corner==bottom-left{border-bottom-left-radius: $radius;}
@if $corner==all || $corner==top || $corner == right || $corner==top-right{border-top-right-radius: $radius;}
@if $corner==all || $corner==bottom || $corner == left || $corner==top-left{border-top-left-radius: $radius;}
}
However, it appears that SASS can only handle one conditional in the if statements? Is there a way round this or do I have to do four if statements for each rounded corner?
然而,SASS似乎只能处理if语句中的一个条件?是否有一种方法来解决这个问题,或者我需要对每个圆角做4个if语句?
2 个解决方案