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/9/three.js/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 如何使用CSS使背景填充整个div_Html_Css - Fatal编程技术网

Html 如何使用CSS使背景填充整个div

Html 如何使用CSS使背景填充整个div,html,css,Html,Css,如何将背景图像展开到全高? 如果您想要全高,可以在css中使用以下选项: img { height:100% } 如果您想要全屏图像,您可以使用: img { height:100%; width:auto; } 使用以下命令: background: url("your image url") no-repeat center center fixed; background-size: cover; -webkit-background-size: cover; -moz-b

如何将背景图像展开到全高?


如果您想要全高,可以在css中使用以下选项:

img { height:100% }
如果您想要全屏图像,您可以使用:

img { height:100%; width:auto; }
使用以下命令:

background: url("your image url") no-repeat center center fixed; 
background-size: cover;  
-webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
见 您必须在CSS中使用
背景大小
属性

要使图像完全覆盖您的div,您可以使用

 background-size:100% 100%;

请在中阅读更多相关信息。

这是您想要实现的目标吗?还是?就是这样!!!thanx人!OP没有
。他在CSS中使用
背景。我建议你在回答之前仔细阅读这个问题。是我的错。对不起
 background-size:100% 100%;