Home > Web Front-end > CSS Tutorial > How to Remove Excess Padding in Bootstrap 3 Columns?

How to Remove Excess Padding in Bootstrap 3 Columns?

Susan Sarandon
Release: 2024-12-18 22:58:10
Original
769 people have browsed it

How to Remove Excess Padding in Bootstrap 3 Columns?

Removing Padding from Bootstrap 3 Columns

Problem:

In Bootstrap 3, there is excessive padding or margin on the right and left sides of col-md-* classes. The goal is to remove this extra space.

HTML Code:

<div class="col-md-12">
    <h2>OntoExplorer.<span>
Copy after login

Desired Output:

Remove the extra padding or margin on the sides of the two columns without disabling the col-md-* class.

Solution:

Typically, .row is used to wrap columns instead of .col-md-12. .Row does not have the additional margins and padding that .col-md-12 has and also eliminates the space that a column would introduce with negative left and right margins.

Updated HTML Code:

<div class="container">
    <div class="row">
        <h2>OntoExplorer.<span>
Copy after login

Custom CSS:

To eliminate the padding or margins entirely, a custom CSS class called .nopadding can be added to remove these properties:

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

The above is the detailed content of How to Remove Excess Padding in 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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template