我在使用height: 100vhSafari for Mac 中的 CSS 设计需要 100% 屏幕高度的 Web 应用程序时遇到问题。
每次我打开一个新选项卡并返回到 Web 应用程序选项卡时,考虑到由于选项卡栏,浏览器现在的空间减少了大约 24 像素,因此不会调整大小。
任何想法来处理这个问题?
代码示例:
HTML文件:
<html>
<head>
<title>Safari Bug</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="app">
<h1>Safari bug instructions</h1>
<ol>
<li>Close all tabs in Safari except this page. (You will see a dark bar at the bottom with buttons)</li>
<li>Open a new tab.</li>
<li>Return to the tab. (If the bug appear, you no longer will see the buttons withouth scrolling)</li>
</ol>
<p></p>
<nav class="toolbar">
<button>Button 1</button>
<button>Button 2</button>
<button>Button 3</button>
</nav>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
CSS文件:
html,
body {
margin: 0;
}
.app {
position: relative;
height: 100vh;
background-color: lightgray;
}
.toolbar {
position: absolute;
bottom: 0;
width: 100%;
background-color: grey;
}
Run Code Online (Sandbox Code Playgroud)
更新:添加了测试代码。目前在 Mojave 10.14.3 上的 Safari 12.0.3 上发生
| 归档时间: |
|
| 查看次数: |
412 次 |
| 最近记录: |