Css 如何在车身背景图像上设置div
!! 对于我的屏幕分辨率来说,它工作得很好。底部div位于背景图像的一半上方,距离背景图像的一半下方。我的问题是,当我测试这个更高分辨率的屏幕时,它看起来不一样。图像正在向下移动。这是我的cssCss 如何在车身背景图像上设置div,css,background-image,overlay,Css,Background Image,Overlay,!! 对于我的屏幕分辨率来说,它工作得很好。底部div位于背景图像的一半上方,距离背景图像的一半下方。我的问题是,当我测试这个更高分辨率的屏幕时,它看起来不一样。图像正在向下移动。这是我的css body { background: #ffffff url(../images/11.jpg) no-repeat center top 0%; -webkit-background-size: cover; -moz-background-size: cover; -
body
{
background: #ffffff url(../images/11.jpg) no-repeat center top 0%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-size: 100% 75%;
font-family: Arial;
}
底分区css
.banner {
width: 100%;
min-height: 300px;
height: 100%;
background-color: #ffffff;
}
如何为所有屏幕大小设置相同的设置。您说图像正在向下移动,是指当您滚动图像时,图像会移动,但您希望它是静态的吗?如果是这样,你可以添加背景附件:固定;这是因为图像的比例不能使图像适合整个屏幕 设定
body {
...
width : 100%;
height : 100%;
}
user3634064所说的是正确的,如果图像不必是全宽的,那么最好将背景图像应用于容器div并在其上设置最大宽度。