noe*_*eat 6 html css mobile android
我正在尝试将我的网站设置为在应用程序中打开,当人们将其添加到移动设备的主页时,但是当我有输入字段时,它无法正常工作.当键盘显示时它保持在内容之上,它不会调整大小.只有通过手机主屏幕上的快捷方式使用时才会发生这种情况.
这是我的manifest.json:
{
"author": "My Name",
"background_color": "#ffffff",
"description": "App",
"display": "fullscreen",
"icons": [
{
"src": "https://192.168.26.183:8080/img/web-app.png",
"sizes": "192x192",
"type": "image/png"
}
],
"manifest_version": 2,
"name": "App",
"orientation": "portrait",
"short_name": "App",
"start_url": "https://192.168.26.183:8080/",
"theme_color": "#ffffff",
"version": "0.1"
}
Run Code Online (Sandbox Code Playgroud)
这是我的HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<!-- Ask user to add to home screen -->
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="manifest" href="manifest.json">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body,
html {
height: 100%;
}
.teste {
height: calc(100% - 10px);
width: 100%;
content: '';
background-color: red;
}
</style>
</head>
<body>
<div class="teste"></div>
<input type="text" id="texteeee">
</body>
</html>Run Code Online (Sandbox Code Playgroud)
您需要将所有内容包装在容器中position: absolute;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<!-- Ask user to add to home screen -->
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="manifest" href="manifest.json">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body,
html {
height: 100%;
}
.wrapper {
position: absolute;
width: 100%;
height: 100%;
overflow: auto;
}
.teste {
height: calc(100% - 20px);
width: 100%;
content: '';
background-color: red;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="teste"></div>
<input type="text" id="texteeee">
</div>
</body>
</html>Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
199 次 |
| 最近记录: |