背景尺寸:盖不工作在纵向上的Andr​​oid平板电脑 [英] background-size: cover not working in portrait on Android tablet

查看:122
本文介绍了背景尺寸:盖不工作在纵向上的Andr​​oid平板电脑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了背景尺寸属性全宽度和高度的背景图像,但无法得到它完全覆盖在Chrome上的Nexus7平板电脑纵向视图。它仅覆盖的宽度,而不是高度,即有一个关于 200像素的下方空白。然而,当我查看该网站的桌面浏览器(或其他),并在垂直显示器模拟画像尺寸覆盖没有问题。

I'm using the background-size property for a full width and height background image but having trouble getting it to fully cover in Chrome on a Nexus7 tablet in portrait view. It only covers the width and not the height i.e. there is about 200px of white space below it. However when I view the site in desktop Chrome (or anything else) and on a vertical monitor to emulate portrait dimensions it covers no problem.

任何人都有一个解决方案吗?

Anyone have a solution?

CSS:

html { 
    background: url(/images/post_bg.jpg) no-repeat center center fixed; 
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/post_bg.jpg', sizingMethod='scale')";
}

人像屏幕截图:

推荐答案

我相信你可以通过定义html和body标签的高度在CSS中,像这样解决这个问题:

I believe you can fix it by defining the height of the html and body tags in the CSS, like so:

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

希望这有助于

hope this helps

这篇关于背景尺寸:盖不工作在纵向上的Andr​​oid平板电脑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆