【发布时间】:2014-04-01 18:06:49
【问题描述】:
我正在使用 csswizardry 中的网格并希望将断点创建为变量... 如果定义为标准“字符串”:
$breakpoints: (
'palm' '(max-width: 480px)'
)!default;
但是当我把它改成:
$palmmaxwidth: 480px;
$breakpoints: (
'palm' '(max-width: $palmmaxwidth)'
)!default;
它不会在 mixin 中正确编译:
@mixin grid-media-query($media-query){
$breakpoint-found: false;
@each $breakpoint in $breakpoints{
$name: nth($breakpoint, 1);
$declaration: nth($breakpoint, 2);
@if $media-query == $name and $declaration{
$breakpoint-found: true;
@media only screen and #{$declaration}{
@content;
}
}
}
@if $breakpoint-found == false{
@warn "Breakpoint ‘#{$media-query}’ does not exist"
}
}
错误是Invalid CSS after "...nd (max-width: ": expected expression (e.g. 1px, bold), was "$palmmaxwidth)"
我错过了什么?
【问题讨论】: