Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/80.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
Html 我的背景图像不是';t在没有高度像素值的情况下加载_Html_Css_Bootstrap 4 - Fatal编程技术网

Html 我的背景图像不是';t在没有高度像素值的情况下加载

Html 我的背景图像不是';t在没有高度像素值的情况下加载,html,css,bootstrap-4,Html,Css,Bootstrap 4,我正在尝试将图像作为背景图像加载为响应背景图像。但是图像没有加载。这是我的CSS代码 .cover{ height: auto; width: 100%; background-image: url(../img/cover.jpg); background-repeat:no-repeat; background-size:contain; background-position:center; } 如果div没有内容,则其高度将为0px,因此

我正在尝试将图像作为背景图像加载为响应背景图像。但是图像没有加载。这是我的CSS代码

.cover{
    height: auto;
    width: 100%;
    background-image: url(../img/cover.jpg);
    background-repeat:no-repeat;
    background-size:contain;
    background-position:center;
}

如果
div
没有内容,则其高度将为
0px
,因此不会显示
背景图像。尝试将高度设定为
350px
say或
100vh
。您可以通过提供
边框来检查div高度。有关更多详细信息,请参阅此项,希望它有助于提供可能重复的最小宽度,这样就可以了。封面{最小宽度:10vw;}@Robin我试过了,但没有work@LaljiTadhani我已经试过了,但找不到明确的解决办法。谢谢。问题是div标签没有值。I应用高度作为高度:100vh;而且效果很好。非常感谢。