Home > Web Front-end > CSS Tutorial > How to Remove Padding and Margin from Bootstrap 3 Columns?

How to Remove Padding and Margin from Bootstrap 3 Columns?

DDD
Release: 2024-12-15 19:02:10
Original
618 people have browsed it

How to Remove Padding and Margin from Bootstrap 3 Columns?

How to remove padding from Bootstrap 3 columns

In Bootstrap 3, using col-md-* classes adds padding and margin to the right and left of columns. To remove this padding and margin, follow these steps:

Use .row instead of .col-md-12

Wrap your columns in a .row container instead of a .col-md-12 container. .row does not have the extra margins and padding that .col-md-12 has.

<div class="container">
    <div class="row">
        <div class="col-md-4">...</div>
        <div class="col-md-8">...</div>
    </div>
</div>
Copy after login

Add a custom class to remove padding and margin

If you want to remove the padding and margin only for specific columns, add a custom class to those columns.

<div class="container">
    <div class="row">
        <div class="col-md-4 nopadding">...</div>
        <div class="col-md-8 nopadding">...</div>
    </div>
</div>

.nopadding {
   padding: 0 !important;
   margin: 0 !important;
}
Copy after login

The above is the detailed content of How to Remove Padding and Margin from Bootstrap 3 Columns?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template