1

正如标题所说,页面上方和下方总是有空格。以下是代码。

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
  <link rel="stylesheet" href="./index.css">
  <title>Document</title>
</head>

<body>
  <p>Hellow World!</p>
</body>

</html>
html {
  height: 100%;
  background-image: linear-gradient(45deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
  background-color: aquamarine;
}

body {
  margin: 0;
}

截图设备为 iPhone 12。

截屏 督察

4

1 回答 1

-1

但它在 IOS 10 和 IOS 11 中完美运行

尝试这个:

<meta name="viewport" content="initial-scale=1, width=device-width, height=device-height, viewport-fit=cover">

html {
padding-top: env(safe-area-inset-top);
}

body{
margin-bottom: env(safe-area-inset-bottom);
}
于 2021-07-25T06:41:22.837 回答