Oren Hizkiya
Oren Hizkiya

Reputation: 4434

How to eliminate space between panels in Bootstrap

I have a series of panels created using the following markup:

<div class="container-fluid">

    <!-- Repeated For Each Panel-->
    <div class="col-sm-4">
        <div class="panel panel-info">
            <div class="panel-heading">
                <h3 class="panel-title">Name</h3>
            </div>
            <div class="panel-body">
                Other info
            </div>
        </div>
    </div>

    ...
</div>

Since the content of the panels is variable in length, the result is: Panels with gaps

(note that the names are randomly generated test data)

How can I eliminate the extra space between the panels -- for example the gap between the items in the first column -- so that all of the panels have an even amount of space between them no matter how much content is in each panel.

Note that I would like to retain the three column layout.

Upvotes: 2

Views: 2614

Answers (2)

cvrebert
cvrebert

Reputation: 9279

You apparently want a Pinterest-like layout. This is typically accomplished using Masonry (or other such similar JavaScript libraries).

Upvotes: 2

Schmalzy
Schmalzy

Reputation: 17324

You should use multiple .row's.

<div class="container-fluid">
    <div class="row">
        <div class="col-sm-4">
            ....
        </div>
        <div class="col-sm-4">
            ....
        </div>
        <div class="col-sm-4">
            ....
        </div>
    </div>
    <div class="row">
        <div class="col-sm-4">
            ....
        </div>
        <div class="col-sm-4">
            ....
        </div>
        <div class="col-sm-4">
            ....
        </div>
    </div>
</div>

Upvotes: 0

Related Questions