Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Horizontal list: inline-block vs flex

Tags:

css

flexbox

horizontal list screenshot

Given a horizontal list, what is the practical difference between:

  • Normal flow, with all the elements being display: inline-block.

and

  • List root is display:flex; flex-flow: wrap;.

I have tested it on different sizes and haven't noticed any differences, but perhaps there are some more subtle implications, especially how the child elements resize?

like image 422
John Smith Avatar asked Jun 15 '26 06:06

John Smith


1 Answers

display:flex; provides some more options concerning the alignment of the items both horizontally and vertically, and also concerning the adaption of their size: shrinking or growing in the flex-direction and aligning their size in the cross-axis direction. inline-blocks simply line up horizontally, keeping their original width and height, and align vertically according to their vertical-align parameter setting.

like image 67
Johannes Avatar answered Jun 17 '26 22:06

Johannes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!