请访问此站点:http://www.themebia.com/pretavivre/
我正在为背景图片使用 slider ,背景图片的宽度为 1920 像素,以便覆盖 24"屏幕的整个屏幕。
我认为,bg 图像的宽度会由浏览器自动调整大小,但高度会创建一个垂直滚动条,用户向下滚动文本框和页脚区域并不是善意的。
如何管理不同屏幕的背景图片高度以适应文本框和页脚区域?
我是否应该使用 max-height 属性和媒体查询来在某些断点处设置图像的最大高度?
最佳答案
试试这个固定的背景图片:
.DivImage
{
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
请访问: http://css-tricks.com/examples/FullPageBackgroundImage/progressive.php
关于jquery - 在不同屏幕上调整背景图像高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23076176/