Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.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_Twitter Bootstrap_Image_Carousel_Scaling - Fatal编程技术网

使用CSS缩放背景图像

使用CSS缩放背景图像,css,twitter-bootstrap,image,carousel,scaling,Css,Twitter Bootstrap,Image,Carousel,Scaling,我正在使用Startbootstrap.com上的以下内容,主页上有一个旋转木马。当我使用CSS属性设置背景图像时,backgroundsize:cover它拉伸图像,但不缩放。如何拉伸图像以覆盖整个旋转木马面板并适当缩放 HTML: 在背景适合:封面上,我相信您正在寻找的是。与background-fit:cover类似,object-fit:cover允许图像覆盖父对象的整个宽度,但不缩放图像,使其保持纵横比 header.carousel .fill { width: 100%;

我正在使用Startbootstrap.com上的以下内容,主页上有一个旋转木马。当我使用CSS属性设置背景图像时,
backgroundsize:cover它拉伸图像,但不缩放。如何拉伸图像以覆盖整个旋转木马面板并适当缩放

HTML:


背景适合:封面上,我相信您正在寻找的是。与
background-fit:cover
类似,
object-fit:cover
允许图像覆盖父对象的整个宽度,但不缩放图像,使其保持纵横比

header.carousel .fill {
    width: 100%;
    height: 100%;                   
    background-repeat: no-repeat;
    background-position: center center;
    object-fit: cover;
}

希望这有帮助!:)

你可以有最小的高度和宽度。
header.carousel .fill {
    width: 100%;
    height: 100%;
    background-size:     cover;                      
    background-repeat:   no-repeat;
    background-position: center center;
}
header.carousel .fill {
    width: 100%;
    height: 100%;                   
    background-repeat: no-repeat;
    background-position: center center;
    object-fit: cover;
}