Nested flexboxes works differently across browsers

后端 未结 4 646
[愿得一人]
[愿得一人] 2020-12-14 07:14

I have a small example of a nested flexbox setup: http://jsfiddle.net/ThomasSpiessens/MUrPj/12/

In this example the following applies:

  • CSS \'box\' cl
4条回答
  •  情歌与酒
    2020-12-14 07:52

    This question has been linked for a specific problem: How to make nested elements in a flex box fill the whole height? The short answer is:

    Use display:flex on the child and avoid height:100%. Here is a simplified example on codepen.

    CourtDemone explained it well (more here):

    According to the flexbox spec, an align-self:stretch value (the default for a flex'd element) changes only the used value of an element's cross-size property (in this case, height). Percentages however are calculated from the specified value of the parent's cross-size property, not it's used value.

提交回复
热议问题