0

.masonry {
    column-count: 1;
    column-gap: 20px;
    max-width: 900px;
    margin: 20px auto;
}

@media only screen and (min-width: 600px) {
  .masonry {
    column-count: 2;
  }
}

.item { 
    background-color: #eee;
    display: inline-block;
    margin: 0 0 1em;
    width: 100%;
  color: #fff;
  font-size: 40px;
}

.item--type1 {
  width: 100%;
  height: 200px;
  background: red;
}
.item--type2 {
  width: 100%;
  height: 400px;
  background: blue;
}
.item--type3 {
  width: calc(50% - 40px);
  height: 600px;
  background: green;
  margin-right: 20px;
}
<div class="masonry">
  <div class="item item--type1">1</div>
  <div class="item item--type2">4</div>
  <div class="item item--type3">2</div>
  <div class="item item--type3">3</div>
</div>

I m just trying to build layout like below image. I tried to with column count :2 can not achieve correct order. Any new solution for this kind of layout?

PS: CSS grid is not working with IE properly. enter image description here

0 Answers0