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

How to Remove Padding from Bootstrap 3 Columns?

DDD
Release: 2024-12-09 15:50:18
Original
365 people have browsed it

How to Remove Padding from Bootstrap 3 Columns?

Remove Padding from Column Elements in Bootstrap 3

Problem:

In Bootstrap 3, you want to eliminate the padding or margin around the col-md-* elements to ensure they fit seamlessly without any extra space on either side.

HTML Code:

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

Solution 1: Use Rows to Wrap Columns

Typically, you should use .row to surround multiple columns instead of nesting them within a single .col-md-12. By using .row, you avoid the unnecessary margins and padding introduced by a nested column.

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

Solution 2: Add Custom Styling

If the first solution does not suffice, you can create a custom class to remove the padding and margins explicitly.

.nopadding {
    padding: 0 !important;
    margin: 0 !important;
}
Copy after login
<div class="container">
    <div class="row">
        <div class="col-md-4 nopadding">
            ...
        </div>

        <div class="col-md-8 nopadding">
            ...
        </div>
    </div>
</div>
Copy after login

The above is the detailed content of How to Remove Padding 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