Open In App

Explain function of the md-grid class in Bootstrap

Bootstrap’s Grid System: The bootstrap grid system is useful in designing the responsive application or website in which the column will rearrange depend upon the screen size. It allows up to 12 columns across the page. You can use each of them individually or merge them together for wider columns. All combinations of values summing up to 12 can be used. It gives the best experience to all devices. With the help of the bootstrap grid system, we can design and customize the width of the screen for small size screen width, medium size screen width, and large size screen width. Some of the classes provided by the Bootstrap grid system are the xs grid class for extra small, sm grid class for small, md grid class for medium, and lg grid class for large.

Grid Classes: Bootstrap grid system contains 5 classes which are listed below:



Components of Grid System:

.md-grid class: It is a class provided by Bootstrap’s grid system that will help to design the interface of websites or apps for a small-size device screen whose screen width is equal to 992px or near to 992px.



Syntax:

<div class="col-md-x">Content</div>

Properties:

Example 1: In this example, the ‘col-mid-6 ‘ denotes 50% of the whole page width for medium size screen device because it will acquire 6 grid columns out of 12 grid columns.




<!DOCTYPE html>
<html lang="en">
 
<head>
 
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href=
 
    <!--Bootstrap Icons CSS -->
    <link rel="stylesheet" href=
</head>
 
<body>
    <!-- Row is class used for displaying
        partition of columns in a row  -->
    <div class="row">
 
        <!-- First partition of 50% width -->
        <div class="col-md-6"
            style="background-color: yellow">
            <h1>Welcome To ,</h1>
        </div>
 
        <!-- Second partition of 50% width -->
        <div class="col-md-6"
            style="background-color: greenyellow">
            <h1>GeeksforGeeks</h1>
        </div>
    </div>
</body>
 
</html>

Output:

output page showing 50%  width acquired with the help of ‘col-md-6″.

Example 2: In this example, the ” col-mid-3 ” denotes 25% of the whole page width because it will acquire 3 grid columns out of 12 grid columns. and ” col-mid-9 ” denotes 75% of the whole page width because it will acquire 9 grid columns out of 12 grid columns for medium size screen devices.




<!DOCTYPE html>
<html lang="en">
 
<head>
 
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href=
 
    <!--Bootstrap Icons CSS -->
    <link rel="stylesheet" href=
</head>
 
<body>
 
    <!-- Row is class used for displaying
        partition of columns in a row  -->
    <div class="row">
 
        <!-- First partition of 50% width -->
        <div class="col-md-3" style=
            "background-color: yellow">
            <h1>Welcome To,</h1>
        </div>
 
        <!-- Second partition of 50% width -->
        <div class="col-md-9" style=
            "background-color: greenyellow">
            <h1>GeeksforGeeks</h1>
        </div>
    </div>
</body>
 
</html>

Output:

output page showing 25% , 75%  width acquired with the help of ‘col-md-3″ , col-md-6 respectively.


Article Tags :