请问有人可以告诉我为什么在一个行方向的 flex 容器中,div 中的文本无法正确换行而会溢出吗?
如果我将方向改为 section
,文本就能正常换行了,我不明白原因...
html,
body {
height: 100%;
}
body {
overflow-y: scroll;
margin: 0;
}
div,
main,
section {
align-items: stretch;
display: flex;
flex-shrink: 0;
flex-direction: column;
flex-wrap: nowrap;
position: relative;
}
main {
flex-grow: 1;
}
section {
flex-flow: row nowrap;
flex-grow: 1;
justify-content: center;
margin: 0 auto;
max-width: 1280px;
padding: 60px 0;
}
.content {
flex-grow: 1;
justify-content: start;
}
<body>
<main>
<section>
<div class="content">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum eget nulla sagittis sem egestas molestie. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
</div>
</section>
</main>
</body>