我有一个背景图像,我想将其固定在较大的屏幕上并在较小的设备上滚动。
这很好用...
#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
并以全尺寸显示(我认为更大)。当我background-attachment: scroll;
在第一组 CSS 中进行测试时,它会做同样的事情。
这个确切的东西似乎在这个网站上工作...... http://www.julytalk.com/我错过了什么?