【发布时间】:2017-03-14 23:45:39
【问题描述】:
我正在尝试按照this 教程设置断点。当我只针对一个属性时,它们工作正常。当我尝试创建一个针对两个(宽度和高度)的查询时,它只显示后者。我研究了我正在使用的 Sass 函数,它应该可以正确渲染,所以我不确定问题出在哪里。我在 Ruby on Rails 版本 4.2.2 上使用 sass-rails。
感谢
$breakpoints: (
'small' : ( max-width: 20em ),
'mobile' : ( min-width: 36.25em ),
'tablet' : ( min-width: 48em ),
'desktop' : ( min-width: 60em ),
'wide' : ( min-width: 75em ),
'height' : ( min-width: 75em ) and (min-height: 62.5em)
);
@mixin media($name) {
@if map-has-key($breakpoints, $name) {
@media #{inspect(map-get($breakpoints, $name))} {
@content;
}
}
@else {
@warn "Unfortunately, no value could be retrieved from `#{$breakpoint}`. "
+ "Please make sure it is defined in `$breakpoints` map.";
}
}
这是渲染的:
@media (min-height: 62.5em) {
}
【问题讨论】:
标签: css ruby-on-rails sass media-queries