html - Android浏览器上的背景图片封面

标签 html css google-chrome browser background

我使用 1900X1200 图像作为我页面的背景:

                  body{
                  background: url(Layout/Ball7.png);
                  background-position: center center;
                  background-repeat:no-repeat;
                 -webkit-background-size: cover;
                 -moz-background-size: cover;
                 -o-background-size: cover;
                  background-size: cover;}

它覆盖了桌面版和 iOs Safari 版的整个屏幕。 事情是,在 android native 浏览器上(我已经在三种不同的设备上尝试过)它在屏幕的顶部和底部留下了一个空白的白色区域(顶部和底部大约有 15% 的空白)。 如果我删除 background-position: center center; ,屏幕的顶部也会成为背景的一部分,但页面底部仍然会有空白(大约。 15%)。我也尝试使用此代码作为解决方案:

height:100%   width: 100%;
height: 100%;  
position: fixed;
top: 0;
left: 0;
z-index: 0; 

但是没有任何运气,屏幕的底部没有被覆盖。我在这里错过了什么吗?我尝试了很多选项,但没有一个完全符合我的需求。

可能的解决方案:我尝试使用非常大的图像 (1900x2500),它确实覆盖了整个屏幕,但这个解决方案是最后的手段,我想坚持使用 1900x1200 的图像。

感谢您对此事的任何了解。

最佳答案

body {
    background: url(Layout/Ball7.png) no-repeat top left fixed; 
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    height:100%;
    margin:0;
    padding:0;
}

关于html - Android浏览器上的背景图片封面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22654629/

相关文章:

javascript - 在页面加载时调整 Canvas 大小

html - 你能在 SASS/SCSS CSS 中使用多个条件吗

html - 如何使内容在 CSS 网格布局中居中?

google-chrome - VisualStudio 报告查看器未在 Chrome 中呈现报告正文

google-chrome - CSS 在 Chrome 中不起作用?

javascript - Chrome 61 的本地存储

javascript - html 如何向现有标签添加文本?

javascript - 如何将节点内容从 xml 复制到硬编码的 html(动态到原始 html)?

javascript - jQuery : using a loop to create many elements with images and html

html - 如何为 IE 浏览器输入自动对焦?