html - 固定标题在移动浏览器上被截断
问题描述
我有一个具有 css 的移动设备的固定标头:
header {
position: fixed;
top: 0;
left: 0;
width: 40%;
height: 70px;
background: #191919;
z-index: 10;
-webkit-transform: translate3d(0,0,0);
padding-top: 10px;
}
这在大多数浏览器中都可以正常工作,但在三星浏览器中,状态栏会被剪切或隐藏,如下图所示,尤其是在滚动时
header {
position: fixed;
top: 0;
left: 0;
width: 40%;
height: 70px;
background: #191919;
z-index: 10;
-webkit-transform: translate3d(0, 0, 0);
padding-top: 20px;
width: 100%;
color: white;
}
.content {
background: red;
position: relative;
padding-top: 70px;
width: 100%;
height: 150vh;
}
<header class="myheader">My Header</header>
<div class="content">Some content</div>
解决方案
这是一个简单的解决方案。我添加了 overflow: scroll to #main { overflow: scroll;}
,包含标题和下面内容的 div 容器,问题已解决。
推荐阅读
- filter - 如何在模块 Amzzing 过滤器中添加更多标准参数?
- c# - 在 Ubuntu 中,如何使用 C# 清除控制台历史记录?
- python - 在 Cray 上运行 dask-mpi
- javascript - 为什么 JavaScript 会产生“this”输出?
- reactjs - 如何使用@msal 在十分钟后触发会话过期弹出窗口 - 反应和天蓝色广告
- python - Event.listens_for 不更新 Session 内的引擎
- centos7 - 新的 CEO 安装无法恢复
- inno-setup - 隐藏 Inno 设置向导小图
- azure-aks - WebserviceException:无法使用 aks 和 azure 机器学习部署模型
- java - 使用 JdbcTest 测试数据库时将 null 作为 jdbctemplate