"Grid Gallery"
Bootstrap 4.1.1 Snippet by SANTANU CHOWDHURY

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="wrapper"> <div> <img src="https://placehold.co/200x200" alt="dummy image"> </div> <div class="horizontal"> <img src="https://placehold.co/800x400" alt="dummy image"> </div> <div> <img src="https://placehold.co/300x200" alt="dummy image"> </div> <div> <img src="https://placehold.co/200x300" alt="dummy image"> </div> <div> <img src="https://placehold.co/300x250" alt="dummy image"> </div> <div class="big"> <img src="https://placehold.co/1000x1000" alt="dummy image"> </div> <div> <img src="https://placehold.co/500x500" alt="dummy image"> </div> <div> <img src="https://placehold.co/500x250" alt="dummy image"> </div> <div class="vertical"> <img src="https://placehold.co/400x800" alt="dummy image"> </div> <div> <img src="https://placehold.co/200x200" alt="dummy image"> </div> <div class="horizontal"> <img src="https://placehold.co/800x400" alt="dummy image"> </div> <div> <img src="https://placehold.co/300x200" alt="dummy image"> </div> <div> <img src="https://placehold.co/200x300" alt="dummy image"> </div> <div> <img src="https://placehold.co/300x250" alt="dummy image"> </div> <div class="big"> <img src="https://placehold.co/1000x1000" alt="dummy image"> </div> <div> <img src="https://placehold.co/500x500" alt="dummy image"> </div> <div> <img src="https://placehold.co/500x250" alt="dummy image"> </div> <div class="vertical"> <img src="https://placehold.co/400x800" alt="dummy image"> </div> </div>
.wrapper{ display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); grid-gap: 5px; grid-auto-flow: dense; } .wrapper img{ object-fit: cover; width: 100%; height: 100%; } .big{ grid-column: auto / span 2; grid-row: auto / span 2; } .horizontal{ grid-column: auto / span 2; } .vertical{ grid-row: auto / span 2; }

Related: See More


Questions / Comments: