我创建了一个测试网页,在position:fixed
和移动版Safari上展示UIWebView
问题:
<!DOCTYPE html>
<html style="overflow: hidden; ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.2, user-scalable=no">
<title>Test</title>
<style type="text/css">
* {
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
body {
margin: 0px;
padding: 0px;
}
.fullscreen {
background: transparent;
display: block;
position: absolute;
top: 0; left: 0;
width: 100%;
height: 100%;
}
.screen {
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
/*-webkit-box-shadow: inset 0 0 10px #0d1f2b;
-moz-box-shadow: inset 0 0 10px #0d1f2b;
-o-box-shadow: inset 0 0 10px #0d1f2b;*/
box-shadow: inset 0 0 10px #0d1f2b;
}
</style>
</head>
<body>
<div class="screen" id="screen"></div>
<form><textarea id="code" name="code" class="fullscreen" rows="1">
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
</textarea></form>
</body>
</html>
重现的步骤:
插入阴影应位于浏览器窗口的边缘,但它位于页面下方的位置不正确。
如何让position:fixed
正常工作?
答案 0 :(得分:1)
原始问题没有答案,但它是一个具有相同结果的解决方案。将身体的样式更改为以下内容:
.body {
margin: 0px;
padding: 0px;
/*-webkit-box-shadow: inset 0 0 10px #0d1f2b;
-moz-box-shadow: inset 0 0 10px #0d1f2b;
-o-box-shadow: inset 0 0 10px #0d1f2b;*/
box-shadow: inset 0 0 10px #0d1f2b;
min-height: 100%;
}
screen
元素可能会被删除。