我正在尝试使我的背景图像在二十十五个主题中响应,特别是对于移动设备,即 360 像素 x 640 像素。我已经尝试了大量的 CSS,但没有骰子。div 是 body.custom-background 我相信。
这是测试站点:test.justinhawleydesign.com
谢谢
贾斯汀
我正在尝试使我的背景图像在二十十五个主题中响应,特别是对于移动设备,即 360 像素 x 640 像素。我已经尝试了大量的 CSS,但没有骰子。div 是 body.custom-background 我相信。
这是测试站点:test.justinhawleydesign.com
谢谢
贾斯汀
您需要 max-width: 100% 并将您的背景中心中心固定。
最好将它放在 html 元素上,因为它更可靠地覆盖了浏览器的整个高度。也就是说,当我在检查器中进行修改时,body 似乎对你来说工作得很好。
body.custom-background {
background: url('http://test.justinhawleydesign.com/wp-content/uploads/2015/09/camera-green22.png') no-repeat center center fixed;
max-width: 100%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}