【发布时间】:2015-03-08 19:43:09
【问题描述】:
我有一张大图片可以放在登录屏幕的中间。它在 IE10 和 Chrome 上显示正常。但它在 Firefox (36.0.1) 上没有显示任何内容。
@media screen and (min-width: 401px) {
body {
background: url("../../Content/images/Eplod Login DrillBit.png") center no-repeat #2b984b;
background-size: auto 90%;
-moz-background-size: auto 90%;
-webkit-background-size: auto 90%;
background-origin: content-box;
}
}
@media screen and (max-width: 400px) {
body {
background: url("../../Content/images/Eplod Login DrillBit.png") center no-repeat #2b984b;
background-size: 600px;
-moz-background-size: 600px;
-webkit-background-size: 600px;
background-origin: content-box;
}
}
我不知道我在哪里做错了。在 Mozilla 开发者网络中展示了background-size 的使用方式;我已经单独放置了每个元素,而不是短手。但是没有任何效果,我现在很困惑。对于大于 401px 的屏幕尺寸不显示任何图像。但是对于 400px 或更小的屏幕,它显示图像但错误。
【问题讨论】:
-
当使用浏览器特定样式(即您使用的前缀规则)时,请将它们放在 W3C 标准之前!另外,你确定你不是指
90% auto,而不是auto 90%?