背景设置高度100%,在弹出软键盘后背景会上缩,,,有什么办法解决吗
html{height: 100%;}
body{
font: "微软雅黑";
background: url(image/bj.jpg) no-repeat center center;
background-size: 100% 100%;
height: 100%;
}
迷茫2017-04-17 11:18:08
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.
高洛峰2017-04-17 11:18:08
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>