Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 如何在车身背景图像上设置div_Css_Background Image_Overlay - Fatal编程技术网

Css 如何在车身背景图像上设置div

Css 如何在车身背景图像上设置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; -

!! 对于我的屏幕分辨率来说,它工作得很好。底部div位于背景图像的一半上方,距离背景图像的一半下方。我的问题是,当我测试这个更高分辨率的屏幕时,它看起来不一样。图像正在向下移动。这是我的css

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并在其上设置最大宽度。