I want to understand how flexbox calculates final flex-item's width when no explicit value is set for flex-basis
, width
, min-width
or max-width
properties are set. In other words, how flexbox calculates flex-item's width based solely on content?
Here is an example code (available on codepen):
.container {
display: flex;
width: 600px;
}
.container div {
outline: 1px dotted black;
}
<div class="container">
<div>Lorem ipsum dolor sit amet consectetur adipisicing elit. Fuga aspernatur suscipit aliquam beatae vitae harum, eius expedita quidem incidunt velit!</div>
<div>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Error ad natus dolores harum, ex fuga voluptates dignissimos possimus saepe officia.</div>
</div>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…