Skip to content

第二个子元素的高度是多少

html
<div class="container">
    <div style="height: 100px"></div>
    <div style="min-height: 10px"></div>
</div>
<style>
    .container{
        display: flex;
    }
    .container > div {
        width: 100px;
    }
</style>

参考答案:

答案:100px

Flex 布局会默认:

  • 把所有子项变成水平排列。
  • 默认不自动换行。
  • 让子项与其内容等宽,并把所有子项的高度变为最高子项的高度。

本答案由“前端面试题宝典”收集整理,PC端访问请前往: https://fe.ecool.fun/