简体   繁体   English

无法删除页面底部的空白(移动设备)

[英]Cannot remove the white space on the bottom of the page (mobile)

I am having a problem with the background image on my body tag. 我的身体标签上的背景图片有问题。 There is a white space on the bottom of the page when viewed on mobile. 在移动设备上查看时,页面底部会有空白。

删除空白

Here is my css code: 这是我的CSS代码:

     body { 
  background:  url("/images/laptop_bg.jpg");
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  background-repeat: no-repeat;
  font-family: 'Proxima Nova', Georgia, sans-serif;
 }

html{
  height: 100%;
}

The solutions I found on stack-overflow does not work. 我在堆栈溢出中发现的解决方案不起作用。 Any help would be appreciated. 任何帮助,将不胜感激。 Thanks 谢谢

Set height: 100vh; 设定height: 100vh; to html AND TRY background-size: 100% 100%; html 并尝试 background-size: 100% 100%;

  body { background: url("https://material.angular.io/assets/img/examples/shiba1.jpg"); -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: 100% 100%; background-repeat: no-repeat; } html{ height: 100vh; } 

For your body tag, set the CSS as follows for a full display of the background-image . 为您的body标签设置CSS ,如下所示,以完整显示background-image

body {

width: 100%;
background-image: url("/images/laptop_bg.jpg");
background-position: 0%, 0%, 50%, 50%;
background-size: auto, cover;
background-repeat: no-repeat;
font-family: 'Proxima Nova', Georgia, sans-serif;

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM