【发布时间】:2012-08-25 10:12:03
【问题描述】:
是否可以在 Chrome 媒体查询中使用 rem 单位?
rem 单元在 Chrome 中完美运行,似乎媒体查询不支持它们。这可能吗?还是这个 CSS 有什么问题?
body { background-color: yellow; }
@media only all and (max-width: 40rem) {
body { background-color: red; }
}
@media only all and (min-width: 40rem) and (max-width: 60rem) {
body {background-color: green;}
}
@media only all and (min-width: 60rem) {
body { background-color: blue; }
}
在http://jsfiddle.net/jsQ2N/2/show/ 直播,em-http://jsfiddle.net/jsQ2N/3/show/ 的唯一版本。
【问题讨论】:
-
看起来这个问题可以使用
em单位来解决。在媒体查询级别,1em 应该等于 1rem(或者建议 github.com/scottjehl/Respond/issues/18#issuecomment-2205078>)。 -
Chrome 28.0.1500.95 确实支持媒体查询中的 rem 单位,但显然 Safari 5.1 不...
标签: css google-chrome media-queries