I'm trying to create a flexbox container that uses flex-wrap: wrap
but once it's wrapped is only as wide as it needs to be, that way it can be centered.
Right now, once I resize the window small enough that the elements wrap, the element continues to use up the maximum width it can, thus causing it's child elements to be pushed all the way to the left.
Here's a link to my Plunker
Here's a gif of me resizing the window. As you can see, when the green and red divs have enough space to be on the same line they appear centered, but not when they wrap. Preferably, there should be as much whitespace to the left of the red div as to the right of the green div.
Preferably, when the rows wrap it should look like this:
Any help would be greatly appreciated!