Flex item with 0

2019-08-09 21:44发布

As can be seen in this simple codepen: http://codepen.io/anon/pen/Mazjyv, there's a button which is a flex item with a flex-basis of 0%.

In other browsers content does not overflow the button container, however on IE11 it does.

Any clue why that is?

1条回答
Juvenile、少年°
2楼-- · 2019-08-09 22:35

The problem is this rule:

button
{
    flex: 0 0 0%;
}

You're telling the button: don't grow, don't shrink, your initial main size is 0.

Instead use:

button
{
    flex: 1 0 0%;
}

Also, btw, the text overflow was also happening in Chrome 46.

查看更多
登录 后发表回答