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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/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
Html 图像未覆盖所有屏幕大小_Html_Css - Fatal编程技术网

Html 图像未覆盖所有屏幕大小

Html 图像未覆盖所有屏幕大小,html,css,Html,Css,我有一个应用于身体的图像,但它并没有覆盖所有的屏幕大小 这是我的HTML: 这就足够做这项工作了 body,html{ 身高:100%; } .bg{ 背景图片:url(“your_image.png”); 身高:100%; 背景位置:中心; 背景重复:无重复; 背景尺寸:封面; } 简单使用css和类型 .bg{ 顶部:0%;左侧:0%;宽度:100%;高度:100%; } html{ 背景:url('https://images.unsplash.com/photo-15928190051

我有一个应用于身体的图像,但它并没有覆盖所有的屏幕大小

这是我的HTML:


这就足够做这项工作了

body,html{
身高:100%;
}
.bg{
背景图片:url(“your_image.png”);
身高:100%;
背景位置:中心;
背景重复:无重复;
背景尺寸:封面;
}

简单使用css和类型

.bg{
顶部:0%;左侧:0%;宽度:100%;高度:100%;
}
html{
背景:url('https://images.unsplash.com/photo-1592819005124-1401b90865dd?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1050&q=80')无重复中心固定;
-webkit背景尺寸:封面;
-moz背景尺寸:封面;
-o-背景尺寸:封面;
背景尺寸:封面;
}

正如其他人回答的那样,您可以使用简单的html和css来实现这一点。以下是快捷方式属性:

body, html {
    height: 100%;
    background: url("url/of/your/image.png") no-repeat cover;
}

以下是有关快捷方式属性和全屏显示的更多信息。

为什么我收到了反对票??我的问题是否不够清楚或令人困惑?请使用“vh”和“vw”代替百分比:
width:100vw;高度:100vh可能两者都
vw