Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.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 中下屏幕上的背景图像使img底部水平空白_Html_Css_Frontend - Fatal编程技术网

Html 中下屏幕上的背景图像使img底部水平空白

Html 中下屏幕上的背景图像使img底部水平空白,html,css,frontend,Html,Css,Frontend,我有一个背景图像问题,中等屏幕和更低。。。 我尝试了背景覆盖属性,但它在图像底部添加了水平空白 我该怎么解决。。。? html在这里 html 要避免空白,请添加: html,body { margin:0; padding:0; } 它将删除浏览器在页面上自动应用的任何边距或填充。您正确使用了“背景大小”属性,但您的主体元素没有到达窗口底部。只需将以下内容添加到您的html: html { height: 100%; min-height: 100%; } 尝试设置html

我有一个背景图像问题,中等屏幕和更低。。。 我尝试了背景覆盖属性,但它在图像底部添加了水平空白 我该怎么解决。。。? html在这里 html


要避免空白,请添加:

html,body {
  margin:0;
  padding:0;
}

它将删除浏览器在页面上自动应用的任何边距或填充。

您正确使用了“背景大小”属性,但您的主体元素没有到达窗口底部。只需将以下内容添加到您的html:

html {
  height: 100%;
  min-height: 100%;
}

尝试设置html和正文的高度,
body,html{height:100%;}
你的意思是这样的吗?请参阅影响@media 909x875和bellow也不起作用。。。我试过了,但问题仍然存在@媒体波纹管909x875box工作正常。。。但是背景没有水平覆盖到盒子上?我想我得到了你需要的。看看我更新的解决方案。很高兴我能帮上忙!别忘了让这个答案被接受:请注意,尽管背景尺寸:cover在CSS3兼容浏览器中运行良好,但它的性能却很差。如果您计划在整个站点上使用大背景图像,那么考虑速度和兼容性两个原因,最好考虑一些JavaScript /jQuery解决方案。
html,body {
  margin:0;
  padding:0;
}
html {
  height: 100%;
  min-height: 100%;
}