css - 在手机上背景显示的问题。
伊谢尔伦
伊谢尔伦 2017-04-17 11:16:08
0
4
656

背景设置高度100%,在弹出软键盘后背景会上缩,,,有什么办法解决吗

html{height: 100%;}
        body{
            font: "微软雅黑";
            background: url(image/bj.jpg) no-repeat center center;
            background-size: 100% 100%;
            height: 100%;
        }

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(4)
迷茫

Cancel the html, the height of the body is 100%, the background is absolutely positioned using the image, the width is 100%, and then the login box is also centered with the same absolute positioning.

刘奇

Automatically try width 100 height

洪涛

Waiting online, urgent

小葫芦

I briefly tested it with your code, and it seems there is no problem. Although the pop-up keyboard will reduce the available height of the screen, it feels like it is covering the screen. You can't see it until you scroll to the bottom of the page. The keyboard takes up screen space. I suspect it is caused by other styles of the page. (Tested on iPad and Windows Phone)

<!DOCTYPE html>
<html>
    <head>
        <title>Test</title>
        <style>
            html{
                height: 100%;
            }
            body{
                background: url('test.jpg') no-repeat center center;
                background-size: 100% 100%;
                height: 100%;
            }
        </style>
    </head>
    <body>
        <h1>Test</h1>
        <input type="text" name="name" value="" />
    </body>
</html>

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template