可重複使用的媒體查詢我試着這樣做:定義在SASS
$media_not_desktop: '@media only screen and (max-width: 959px)';
然後
.wrap {
color: #fff;
$media_not_desktop {
color: #555;
}
}
,但我得到一個語法錯誤。你會如何做到這一點?
可重複使用的媒體查詢我試着這樣做:定義在SASS
$media_not_desktop: '@media only screen and (max-width: 959px)';
然後
.wrap {
color: #fff;
$media_not_desktop {
color: #555;
}
}
,但我得到一個語法錯誤。你會如何做到這一點?
我相信這是目前薩斯不可能實現的。不過,在Sass bug tracker上有一個打開的問題。
可以在青菜3.2爲此,目前作爲一個alpha版本 http://thesassway.com/intermediate/responsive-web-design-in-sass-using-media-queries-in-sass-32下變量作爲完整的查詢。
語法有點不同,但本質上是相同的功能。
Sass 3.2現已上市並且穩定。我做了類似的事情,因爲我想重複使用我的媒體查詢並輕鬆創建響應式Web。檢查我的mixins:http://paranoida.github.com/sass-mediaqueries – 2012-08-24 20:37:47