Skip to content Skip to sidebar Skip to footer

Flex-box Two Boxes Wrap When Scaling Window Browser

We have four children in one parent. And I want to make effect which you see on the picture.
Copy

Solution 2:

Good evening The Agropl!

Maybe this is something that can help you in the right direction - im still new to using flexbox, so if this can be done more correct, feel free to correct me. :)

http://codepen.io/andreastherkildsen/pen/pNeajo

<div class="flex-container">
  <div class="flex-item">
    <h3>1</h3>
    <p>Lorem ipsum, Lorem ipsum,Lorem ipsum,Lorem ipsum,Lorem ipsum,Lorem ipsum,Lorem ipsum,Lorem ipsum,</p>
  </div>
  <div class="flex-item">
     <h3>1</h3>
    <p>Lorem ipsum, Lorem ipsum,Lorem ipsum,Lorem ipsum,Lorem ipsum,Lorem ipsum,Lorem ipsum,Lorem ipsum,</p>
  </div>

  <div class="flex-item">
     <h3>1</h3>
    <p>Lorem ipsum, Lorem ipsum,Lorem ipsum,Lorem ipsum,Lorem ipsum,Lorem ipsum,Lorem ipsum,Lorem ipsum,</p>
  </div>

  <div class="flex-item">
     <h3>1</h3>
    <p>Lorem ipsum, Lorem ipsum,Lorem ipsum,Lorem ipsum,Lorem ipsum,Lorem ipsum,Lorem ipsum,Lorem ipsum,</p>
  </div>
 </div>

and the style

.flex-container{
  height: 500px;
  background: blue;
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  align-items:  baseline;
  -webkit-flex-flow: row wrap;
  justify-content: space-around;

}

.flex-item{
  background: tomato;
  width: 300px;
  height: auto;
  margin-top: 10px;
  color: white;
  font-weight: bold;
  text-align: center;
  display: flex;
}

.flex-item h3{
  font-size: 50px;
  padding-left: 50px;
}

.flex-item p{
  font-size: 16px;
  padding-left: 50px; 
}

@media all and (max-width: 1230px) {
  .flex-item{
    padding-right:100px;
  }
}

Post a Comment for "Flex-box Two Boxes Wrap When Scaling Window Browser"