Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.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 如何使背景图像成为所有屏幕中的响应_Css - Fatal编程技术网

Css 如何使背景图像成为所有屏幕中的响应

Css 如何使背景图像成为所有屏幕中的响应,css,Css,我刚刚创建了关于我们的页面,并添加了横幅作为背景图像。当我缩小屏幕时,图像会被分解。它不会响应所有屏幕。这是css section.titlebar { background: url(../images/team-bg03.jpg); background-repeat: no-repeat; background-position: 0px 89px !important; height: 914px;} 尝试添加此 section.titlebar { background:

我刚刚创建了关于我们的页面,并添加了横幅作为背景图像。当我缩小屏幕时,图像会被分解。它不会响应所有屏幕。这是css

section.titlebar {
background: url(../images/team-bg03.jpg);
background-repeat: no-repeat;    
background-position: 0px 89px !important;
height: 914px;}
尝试添加此

 section.titlebar {
background: url(../images/team-bg03.jpg);   
background-repeat:no-repeat;
background-size:contain;
background-position:center;
}

如果我将背景大小指定为contain,则不会获得全宽横幅,但我需要获得全宽横幅

您需要的是
封面
属性。但是-这可能会导致在不同断点处对图像进行一些裁剪

section.titlebar{
背景:url(../images/team-bg03.jpg);
背景重复:无重复;
背景尺寸:封面;
背景位置:中心;

}
图像不应裁剪为任何尺寸,以使图像饱满image@user2630366除非图像的纵横比始终与其父图像的纵横比匹配,否则在不失真或剪切的情况下,您将无法实现这一点。