【发布时间】:2014-09-19 18:09:49
【问题描述】:
我有一个背景图像,我想将其固定在较大的屏幕上并在较小的设备上滚动。
这很好用...
#main_page {
height: 100%;
min-height: 100%;
background-image:url('url');
background-position: 50% 50%;
background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
}
但是我希望能够使用...
@media (max-width: 991px) {
#main_page { background-attachment:scroll; }
}
使用background-attachment:scroll 似乎会杀死background-size:cover 并以全尺寸显示(我认为更大)。当我在第一组 CSS 中测试 background-attachment: scroll; 时,它会做同样的事情。
这个确切的东西似乎在这个网站上工作......http://www.julytalk.com/我错过了什么?
【问题讨论】:
-
旁注:背景大小不需要加前缀AFAIK
标签: css background-image background-attachment