Safari Flexbox:如果内容太高,导航不会从孩子的身高上飞过

问题描述 投票:1回答:1

我的应用程序具有以下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高于视图本身时,它与header/navbarfooter重叠,并且突然header/navbar不会继承其高度子元素。

示例:

good case

bad case

[我看过flexbug,试图给出flex: 1 1 0flex: autoheight:100%等,但没有任何效果。

html css safari flexbox
1个回答
0
投票

我通过在页眉和页脚样式表中添加min-height: fit-content;来解决此问题。

© www.soinside.com 2019 - 2024. All rights reserved.