I have an unlimited/unbound number of DIV tags that are floating to the left.
As the browser is resized, the DIV tags wrap to the next line.
Because the DIV tags wrap based on whether or not they have enough spacing on the right side of the screen, when they do wrap, it leaves a large space on the right side of the screen.
So if the DIV was 32x32, a 32x32 space would be left on the right side of the screen.
I would like the parent DIV to center the contents in this situation, so if there was, for example, a 32px space on the right side as the result of the wrap, it would adjust the child contents to have 16px on the left side and 16px on the right side.
For example, without the contents being centered, the screen would look like the following:
[DIV] [DIV] [DIV] [DIV]..GAP.|
[DIV] <-Wrapped.................|
I would like to put these DIVs inside of a parent so that when the DIV was wrapped, the contents would look like the following:
.....[DIV] [DIV] [DIV] [DIV].....| <- Centered, but still floating left.
.....[DIV]..............................| <- Parent is centered, but DIV is still floating left.
The wrapping is still allowed, but as the browser shrinks or grows horizontally, the parent DIV automatically adjusts the content of the child DIVs to center.
How can I accomplish this?