I have a simple layout concept that can be reduced to the following image: 
This can be easily achieved using flexbox . As you can see, div # 1 and div # 3 touch the borders of their container. In addition, the margin between div # 1 and div # 2 is equal to the difference between div # 2 and div # 3. This can be done with:
.inner-div{ margin-left:10px; } .inner-div:first-child{ margin-left:0px; }
Now let's say that the width of the viewport is decreasing. I want those divs to turn around to form a nice column. And I would like them to look like this:

But if those divs keep their configuration horizontal, they look something like this:

That, as you might guess, is undesirable.
How to change the margins for these inner divs when their container is so narrow that they are βwrappedβ? Is there a way to write a conditional rule that will only apply to wrapped divs? Or am I missing a point, and the solution is very obvious, and I just missed this part of the flex-box features? I would like to see a solution that would not involve predicting what width of the container / screen will take into account the layout change from row to column, because I think this is the most convenient option.
html css flexbox css3 responsive-design
Kuba orlik
source share