Open In App

How Specify Length and Width of Square Grid Picture System in Bootstrap?

Last Updated : 07 May, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

The length and width of the Square Grid picture can be specified by the traditional method of CSS that can be incorporated in our HTML code easily with a style tag or by using a link tag. When it comes to Bootstrap, it provides a much easier and effective way to perform the same task with less effort. To Specify Length and Width of Square Grid Picture in Bootstrap you need the basic concept of Bootstrap Grid System. There are five classes in Bootstrap that changes the length and width with that basic concept you can easily increase or decrease the length of any images which is inside the grid column.

  • .col-
  • .col-sm-
  • .col-md-
  • .col-lg-
  • .col-xl-

Example 1: Here you will see three images with the same width of grid, But if the screen is smaller than the third grid will change the row and become wider than other two. 

Example: 

html




<!DOCTYPE html>
<html lang="en">
 
<head>
    <title>Bootstrap Grid System</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet"
    <script src=
    </script>
    <script src=
    </script>
    <script src=
    </script>
 
    <style>
        .col {
            text-align: center;
            border: 1px solid black;
        }
    </style>
</head>
 
<body>
    <div class="container">
        <div class="row">
            <div class="col">
                <img src=
            </div>
            <div class="col">
                <img src=
            </div>
            <div class="col">
                <img src=
            </div>
        </div>
    </div>
</body>
 
</html>


Output: 

Example 2: Here you will see three different widths of a grid containing images. 

Example: 

html




<!DOCTYPE html>
<html lang="en">
 
<head>
    <title>Bootstrap Grid System</title>
    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1">
    <link rel="stylesheet"
    <script src=
    </script>
    <script src=
    </script>
    <script src=
    </script>
    <style>
        .col {
            text-align: center;
            border: 5px solid black;
        }
         
        div {
            border: 1px solid black;
        }
    </style>
</head>
 
<body>
    <div class="container">
        <br>
        <center>
            <div class="row">
                <div class="col-sm-3">
                    <img src=
                </div>
                <div class="col-sm-6">
                    <img src=
                </div>
                <div class="col-sm-3">
                    <img src=
                </div>
            </div>
        </center>
    </div>
</body>
 
</html>


Output: 



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads