[英]SCSS: Assigning two values to a variable
我正在使用這個mixin來生成媒體查詢。 mixin通過插入兩個值(最小寬度和可選的最大寬度)來工作:
@include respond-to(300px,500px) {
.this-is-not-in-ie-either { color: green; }
}
麻煩的是,最大/最小寬度值難以記住。 我寧願插入關鍵字變量。
例如
$mob: 0, 480px;
$tab: 480px, 940px;
但是,SCSS誤解了這一點,因為最小寬度為“0,480px”,最大寬度為“未定義”。
是否可以有一個包含兩個值的變量。
我知道我可以使用兩個關鍵詞(例如$ mob-min,$ mob-max),但我寧願只使用一個。
當你寫這個:
$mob: 0, 480px;
@include respond-to($mob) {
.this-is-not-in-ie-either { color: green; }
}
你實際做的是將列表作為第一個參數傳遞給mixin:
@include respond-to($mixins-first-arg: (300px,500px)) {
.this-is-not-in-ie-either { color: green; }
}
你需要寫的是:
@include respond-to($mob...) {
.this-is-not-in-ie-either { color: green; }
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.