There is a container that contains elements (Maybe any number). The main thing is that the elements are transferred.
In example 1, this is implemented. But I would like to apply the flex properties for the blocks inside the container. THOSE. the blocks inside the container must have the same size and fill the entire width and height of the container; if the number of blocks is larger than can fit in the container, then the blocks need to be transferred.
Example 1 is implemented as:
/* Common Styles */ .content, .content1, .content2 { color: #fff; font: 100 24px/100px sans-serif; height: 150px; text-align: center; } .content div, .content1 div, .content2 div { height: 50%; width: 50%; } .red { background: orangered; } .green { background: yellowgreen; } .blue { background: steelblue; } /* Flexbox Styles */ .content { display: flex; flex-wrap: wrap; } <div class="content"> <div class="red">1</div> <div class="green">2</div> <div class="blue">3</div> <div class="red">4</div> <div class="green">5</div> <div class="blue">6</div> </div> As you can see from the example, the size of the blocks inside the container is set in pixels and percentages;
I am wondering whether it is possible to do with flex properties only (but in order to observe the transfer as in example 1)?
Example 2. How I tried to solve this problem.
.content div, .content1 div, .content2 div { flex: 1; } .red { background: orangered; } .green { background: yellowgreen; } .blue { background: steelblue; } /* Flexbox Styles */ .content { display: flex; flex-wrap: wrap; } <div class="content"> <div class="red">1</div> <div class="green">2</div> <div class="blue">3</div> <div class="red">4</div> <div class="green">5</div> <div class="blue">6</div> </div> As can be seen from example 2, the blocks are not transferred. How can this problem be solved?
min-width. - Vadim Ovchinnikov