CSS CSS Flexbox Layout Flexbox Properties Distributing Space Inside a Flex Container

Victor Mercier
Victor Mercier
4,675 Points

Effect of margin auto on flex items

I do not understand this: a margin set to auto will ABSORB any extra space around a flex items push other flex items in different positions.

Please, try to explain me this clearer and give me futher information because I do not really catch it.

Thanks in advance!

1 Answer

Jamie Reardon
Jamie Reardon
Front End Web Development Techdegree Student 12,522 Points

If your flex-container contains extra space (that is what the flex-items do not take up), the margin value auto, will take all of that remaining space up of the flex-container. Think of the way absorb means in that it will take all that space up and then use it for whatever margin effect you are going for, e.g. margin-left and margin-right.