#Need help in understanding flex-items

3 messages · Page 1 of 1 (latest)

jovial moon
#

I'm wondering why the blue colored boxes does not start from the beginning. I have added flex-start to the parent. I need help to understand how that works. Thanks

https://scrimba.com/scrim/cgWQRes7

Scrimba

Learn to code with interactive screencasts. Our courses and tutorials will teach you React, Vue, Angular, JavaScript, HTML, CSS, and more. Scrimba is the fun and easy way to learn web development.

normal mortar
#

Now, after doing this, you want to harmonize the size of you li. First, reduce the padding on li to padding: 10px, so we can see what is happening.
Then, give them flex: 1
Flex: 1 is a shorthand property. Here, it basically means: you, child element, take as much space as you can on your row while fitting as many elements as you can.
Now, you can remove flex-start on the parent as it's now useless.
https://scrimba.com/scrim/coab143b7a3b9826db3cd96d1