Css width vs. flex-basis: what’s the Difference?
There is a time in every frontend developer's life when they learn flexbox and ask: what is the difference between
flex-basis? They look the same at first glance.
The answer is that in some cases they are them same. There are a couple edge cases you have to be aware of.
flex-basisby default is equal to
widthif set, or the width of the content.
- If there is a
flex-basiscan overwrite that.
flex-basisworks on the main axis. This is the most notable difference.
- If you also set a
min-width, that can overwrite your
It's really that simple folks.