Answers for "3 images grid css"

0

how to sort image in html into a 2x2 grid

<style>
.container {
  display: flex;
  flex-wrap: wrap;
}

.container .image {
  width: 50%;
}

.container img {
  width: calc(100% - (20px * 2));
  margin: 20px;
}
</style>
<div class="container">
  <div class="image">
    <img src="http://placehold.it/50" />
  </div>
  <div class="image">
    <img src="http://placehold.it/50" />
  </div>
  <div class="image">
    <img src="http://placehold.it/50" />
  </div>
  <div class="image">
    <img src="http://placehold.it/50" />
  </div>
</div>
Posted by: Guest on July-18-2020

Browse Popular Code Answers by Language