Here is an example of the grid system. You need to create a row to hold all of the sections. Then inside the row, create 2 columns, left and right. On the right column, create 2 rows.

So the structure should be like this:

- row
    - column
    - column
        - row
        - row

<html>
  <head>
        <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
  </head>
  <body>
    <div class="container">
      <div class="row">
        <div class="col" style="padding:100px; background:red;">
          1
        </div>
        <div class="col">
          <div class="row" style="padding:100px; background:blue;">
            2
          </div>
          <div class="row" style="padding:100px; background:gray;">
            3
          </div>
        </div>
      </div>
    </div>
  </body>
</html>

Answer from Regn on Stack Overflow
🌐
Bootstrap
getbootstrap.com › docs › 4.2 › layout › grid
Grid system · Bootstrap
Bootstrap’s grid system uses a series of containers, rows, and columns to layout and align content. It’s built with flexbox and is fully responsive.
🌐
MDBootstrap
mdbootstrap.com › standard › image grid
Bootstrap Image grid - free examples & tutorial
Responsive Image grid built with Bootstrap 5. Bootstrap image grid is a simple construction that allows you to create a responsive layout for your images.
🌐
W3Schools
w3schools.com › bootstrap › bootstrap_images.asp
Bootstrap Images
BS Grid System BS Stacked/Horizontal BS Grid Small BS Grid Medium BS Grid Large BS Grid Examples · BS Templates BS Theme "Simply Me" BS Theme "Company" BS Theme "Band" BS Examples BS Editor BS Quiz BS Exercises BS Interview Prep BS Certificate · CSS All Classes CSS Typography CSS Buttons CSS Forms CSS Helpers CSS Images CSS Tables CSS Dropdowns CSS Navs Glyphicons
🌐
Noble Desktop
nobledesktop.com › bootstrap: creating a photo grid
Bootstrap: Creating a Photo Grid | Free Mobile & Responsive Web Design Tutorial
June 5, 2025 - It explains how to lay out a photo grid with Bootstrap, allowing for responsive design that fits any screen size. The tutorial provides a step-by-step guide on how to nest columns to fit multiple images while keeping a neat and clean design.
🌐
FreeFrontend
freefrontend.com › bootstrap-grid-examples
29 Bootstrap Grid Examples
January 1, 2025 - A clever Bootstrap 5 grid hack enabling a split layout where an image extends to the viewport edge (fluid) while text stays within the standard grid (container).
🌐
Mobirise
mobirise.com › bootstrap-gallery
Bootstrap Image Gallery with Responsive Grid
January 1, 2022 - Your gallery will be responsive - it means that its thumbnail elements will look good on most desktop and mobile devices. It also has a touch-swipe feature enabled. This layout mode allows placing image thumbnails in optimal, responsive grid, so your gallery will look like a stone wall, where ...
Top answer
1 of 3
1

You can achieve this with card columns. JSFiddle here:

<div class="container-fluid pt-3">
<div class="card-columns">
<div class="card">
<img class="card-img-top" style="width:100%; height: 200px;"/>
</div>
<div class="card">
<img class="card-img-top" style="width:100%; height: 500px;"/>
</div>
<div class="card">
<img class="card-img-top" style="width:100%; height: 300px;"/>
</div>
<div class="card">
<img class="card-img-top" style="width:100%; height: 400px;"/>
</div>
<div class="card">
<img class="card-img-top" style="width:100%; height: 400px;"/>
</div>
<div class="card">
<img class="card-img-top" style="width:100%; height: 300px;"/>
</div>
<div class="card">
<img class="card-img-top" style="width:100%; height: 500px;"/>
</div>
<div class="card">
<img class="card-img-top" style="width:100%; height: 200px;"/>
</div>
<div class="card">
<img class="card-img-top" style="width:100%; height: 200px;"/>
</div>
<div class="card">
<img class="card-img-top" style="width:100%; height: 500px;"/>
</div>
<div class="card">
<img class="card-img-top" style="width:100%; height: 300px;"/>
</div>
<div class="card">
<img class="card-img-top" style="width:100%; height: 400px;"/>
</div>
</div>
</div>
2 of 3
1

depending on you requirement, you need to replace col-3 with col-sm-3 or col-md-3, etc:

img
{
  width: 100%;
  margin: 10px 0px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<div class="row">
  <div class="col-3">
   <img src="https://www.w3schools.com/w3images/nature.jpg" alt="Lights" >
   <img src="https://www.w3schools.com/w3images/falls2.jpg" alt="Lights" >
   <img src="https://www.w3schools.com//w3images/wedding.jpg"alt="Lights" >
  </div>
  <div class="col-3">
   <img src="https://www.w3schools.com/w3images/rocks.jpg" alt="Lights" >
   <img src="https://www.w3schools.com/w3images/fjords.jpg" alt="Lights" >
  </div>
  <div class="col-3">
   <img src="https://www.w3schools.com/w3images/fjords.jpg" alt="Lights" >
   <img src="https://www.w3schools.com/w3images/lights.jpg" alt="Lights" >
   <img src="https://www.w3schools.com//w3images/wedding.jpg"alt="Lights" >
  </div>
  <div class="col-3">
   <img src="https://www.w3schools.com/w3images/nature.jpg" alt="Lights" >
   <img src="https://www.w3schools.com//w3images/rocks.jpg" alt="Lights" >
  </div>
</div>

Find elsewhere
Top answer
1 of 1
11

The columns in bootstrap have padding on them. I would add a class to your <div class="row"> and remove the padding to the columns via css.

Like this:

<div class="container">
    <div class="row imagetiles">
        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-6">
            <img src=https://i.scdn.co/image/2fd8fa0f7ef2f83691a0fb9628ee369b8e3b688e class="img-responsive">
        </div>
        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-6">
            <img src=https://i.scdn.co/image/2fd8fa0f7ef2f83691a0fb9628ee369b8e3b688e class="img-responsive">
        </div>
        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-6">
            <img src=https://i.scdn.co/image/2fd8fa0f7ef2f83691a0fb9628ee369b8e3b688e class="img-responsive">
        </div>
        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-6">
            <img src=https://i.scdn.co/image/2fd8fa0f7ef2f83691a0fb9628ee369b8e3b688e class="img-responsive">
        </div>
    </div>
</div>

    <style>
  div.imagetiles div.col-lg-3.col-md-3.col-sm-3.col-xs-6{
  padding: 0px;
}
    </style>

JsFiddle Demo

That takes care of the space on desktop. You can adjust this space between the images by adjusting the padding on the columns via CSS. For mobile devices - just use media queries. Bootstrap has the following queries:

/* Large desktops and laptops */
@media (min-width: 1200px) {

}

/* Landscape tablets and medium desktops */
@media (min-width: 992px) and (max-width: 1199px) {

}

/* Portrait tablets and small desktops */
@media (min-width: 768px) and (max-width: 991px) {

}

/* Landscape phones and portrait tablets */
@media (max-width: 767px) {

}

/* Portrait phones and smaller */
@media (max-width: 480px) {

}

Example:

    @media(max-width: 480px){
div.imagetiles div.col-lg-3.col-md-3.col-sm-3.col-xs-6{
      padding: 5px;}
}
🌐
GeeksforGeeks
geeksforgeeks.org › how-to-use-grid-for-images-in-bootstrap-card
How to use grid for images in bootstrap card ? | GeeksforGeeks
January 29, 2020 - It includes options for headers, footers, content, colors, links etc.Car ... The Bootstrap Grid System is a flexible and responsive layout system that allows developers to create complex and responsive web layouts.
🌐
CodePen
codepen.io › sruthil › pen › XWWpEer
Responsive Image Grid compatible with bootstrap
<!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> <title>Image Grid</title> </head> <body> <section> <div class="container"> <div class="img-container-grid"> <div class="smallsquare"><img src="https://cdn.pixabay.com/photo/2018/05/28/22/
🌐
Bootstrap
getbootstrap.com › docs › 4.0 › content › images
Images · Bootstrap
Skip to main content There's a newer version of Bootstrap! ... Documentation and examples for opting images into responsive behavior (so they never become larger than their parent elements) and add lightweight styles to them—all via classes.
🌐
W3Schools
w3schools.com › howto › howto_css_image_grid_responsive.asp
How To Create a Responsive Image Grid
Tip: Go to our Image Grid Tutorial to learn how to create a clickable grid that varies between columns.
🌐
C# Corner
c-sharpcorner.com › article › overview-of-bootstrap-buttons-and-grid-offset
Overview Of Bootstrap Image Shapes And Grid Offset
January 15, 2019 - Overview of Bootstrap buttons and Grid Offset. See how to create Bootstrap image shapes & Grid Offset columns, using img classes and generate Responsive Embeds, Responsive images in Bootstrap.
🌐
Bootstrap Studio Forum
forum.bootstrapstudio.io › webdesign help
How to do this grid with images? - Webdesign Help - Bootstrap Studio Forum
August 11, 2024 - Hello, I’m wondering if is possible to arrange my pictures in this way (look attachment)
Top answer
1 of 3
2

Instead of using d-flex class use row row-cols-1 row-cols-sm-2 row-cols-md-4 or you can refer this https://getbootstrap.com/docs/4.5/layout/grid/#row-columns Also to make things easy you can use card grid https://getbootstrap.com/docs/4.5/components/card/#grid-cards it will automatically handle the responsiveness of the layout and you can make tweaks accordingly.

2 of 3
1

try something like this

I added media query, used flexbox and changed the max width and height of images

HTML

`

        <div class="img-wrapper-20">
            <img src="https://informnutrition.com/wp-content/uploads/2019/03/Super-booster-Sheep-400x300.png"  class="img-fluid img-thumbnail shadow img-dimension" alt="Sheep 11">
            <p class="galp">Some Text</p>
        </div>

        <div class="img-wrapper-20">
            <img src="https://informnutrition.com/wp-content/uploads/2019/03/Super-booster-Sheep-400x300.png"  class="img-fluid img-thumbnail shadow img-dimension" alt="Sheep 11">
            <p class="galp">Some Text</p>
        </div>

        <div class="img-wrapper-20">
            <img src="https://informnutrition.com/wp-content/uploads/2019/03/Super-booster-Sheep-400x300.png"  class="img-fluid img-thumbnail shadow img-dimension" alt="Sheep 11">
            <p class="galp">Some Text</p>
        </div>

        <div class="img-wrapper-20">
            <img src="https://informnutrition.com/wp-content/uploads/2019/03/Super-booster-Sheep-400x300.png"  class="img-fluid img-thumbnail shadow img-dimension" alt="Sheep 11">
            <p class="galp">Some Text</p>
        </div>

        <div class="img-wrapper-20">
            <img src="https://informnutrition.com/wp-content/uploads/2019/03/Super-booster-Sheep-400x300.png"  class="img-fluid img-thumbnail shadow img-dimension" alt="Sheep 11">
            <p class="galp">Some Text</p>
        </div>
    </div>
</div>`

CSS:

.container {
    padding: 5rem 0rem;
}

.img-wrapper-20 {
    max-width: 20%;
    margin: 0rem 1.5rem 0rem 0rem;
}
.img-wrapper-20 img:hover {
        transform: scale(1.08);
    }

.galp {
    margin-top: 20px;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: black;
}

.img-dimension {
    max-width:100%;
}

@media screen and (max-width: 1000px) {
    .d-flex {
        display:flex;
        flex-direction: column;
        overflow: auto;
    }
    .img-wrapper-20 {
        max-width: 80%;
        margin: 0rem 1.5rem 0rem 0rem;
    }
}

@media screen and (min-width: 1000px) {
    .d-flex {
        display: flex;
        flex-direction: row;
        overflow: auto;
    }

}
🌐
Bootstrap
getbootstrap.com › docs › 5.1 › content › images
Images · Bootstrap v5.1
There's a newer version of Bootstrap! ... Documentation and examples for opting images into responsive behavior (so they never become wider than their parent) and add lightweight styles to them—all via classes.
🌐
Codeply
codeply.com › go › cFTCA9VEnk › bootstrap-3-responsive-images
Bootstrap 3 Responsive Image Grid
HTML, CSS, JavaScript editor playground for designers & developers to compare, prototype and test frontend frameworks