How to set line spacing in bootstrap

爱喝马黛茶的安东尼
Release: 2019-07-17 14:32:41
Original
12265 people have browsed it

How to set line spacing in bootstrap

For example, the following HTML code based on Bootstrap framework layout needs to add spacing (padding or margin) between each line. What methods can be achieved?

<div class="row">
        <div class="col-lg-4"></div>
        <div class="col-lg-4"></div>
        <div class="col-lg-4"></div>
    </div>
    <div class="row">
        <div class="col-lg-4"></div>
        <div class="col-lg-4"></div>
        <div class="col-lg-4"></div>
    </div>
    <div class="row">
        <div class="col-lg-4"></div>
        <div class="col-lg-4"></div>
        <div class="col-lg-4"></div>
    </div>
    <div class="row">
        <div class="col-lg-4"></div>
        <div class="col-lg-4"></div>
        <div class="col-lg-4"></div>
    </div>
    <div class="row">
        <div class="col-lg-4"></div>
        <div class="col-lg-4"></div>
        <div class="col-lg-4"></div>
    </div>
Copy after login

Related recommendations: "bootstrap Getting Started Tutorial"

Option 1

Add a new style class and define margin -top style, such as:

.top-buffer { margin-top:20px; }
Copy after login

Then, add the style class on the div element where row is located, such as:

<div class="row top-buffer"> ...</div>
Copy after login

Option 2

Define some common top margin style classes, such as:

.top5 { margin-top:5px; }
.top7 { margin-top:7px; }
.top10 { margin-top:10px; }
.top15 { margin-top:15px; }
.top17 { margin-top:17px; }
.top30 { margin-top:30px; }
Copy after login

Then, add a suitable CSS style class to the div element where the row is located, such as:

<div class="row top7"></div>
Copy after login

Option 3

In Bootstrap 4, you can use the built-in spacing style class (see here for details), such as:

<div class="row mt-3"></div>
Copy after login

The above is the detailed content of How to set line spacing in bootstrap. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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