2

我创建了一个测试网页,展示了Mobile Safariposition:fixed上的问题: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>

重现步骤:

  1. 在 iPad 或 iPhone 上的 Mobile Safari 上打开演示网页。
  2. 点击文本区域以显示键盘。
  3. 向上或向下滚动以查看问题。

嵌入阴影应该沿着浏览器窗口的边缘,但它错误地位于页面下方。

在此处输入图像描述

我怎样才能使position:fixed工作正常?

4

1 回答 1

1

原始问题没有答案,但它是具有相同结果的解决方案。将 body 的样式更改为以下内容:

.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元素可能会被移除。

于 2013-10-04T12:21:22.093 回答