html - Safari Flexbox:如果内容太高,导航不会从孩子那里获得高度
问题描述
我的应用程序具有以下HTML
结构:
body
viewport
navbar
container
content
footer
viewport:
min-height: 100vh;
max-height: 100vh;
display: flex;
flex-direction: column;
overflow-x: hidden;
navbar/header:
background: #fff;
position: -webkit-sticky;
position: sticky;
top: 0;
z-index: 20;
align-items: flex-start;
container:
flex-grow: 1;
width: 100%;
padding: 0 15px;
margin: 0 auto;
我的问题只存在于 中Safari
,因此当content
高于视图本身时,它与 and 重叠,header/navbar
并且footer
突然header/navbar
不继承其子元素的高度。
例子:
我查看了 flexbugs 并尝试提供flex: 1 1 0
,等flex: auto
,height:100%
但没有任何效果。
解决方案
我通过添加min-height: fit-content;
页眉和页脚样式表解决了这个问题。
推荐阅读
- python - 如何为 python3.8.1 正确安装 scipy?
- go - 很奇怪的问题函数正常运行不会报错但是在debug模式下启动会报错
- python - 如何计算隐式数据结构中某物的实例?
- sql-server - 将 SQL Server 字符串转换为日期时间以导入 Oracle
- javascript - 如何清空所有 HTML 元素中的所有类属性
- php - 如何为这个自定义的 rest API 进行分页?
- php - Cakephp 2 Containable 在自定义库中不起作用
- php - 如何删除 WordPress 帖子中的帖子标题和帖子内容?
- python - 我需要读取文本文件并使用 python 将特定值插入 csv 文件
- python - 替换熊猫数据框中的多个字符