Keeping a bit of vertical space between elements when they wrap?

What happens here is the buttons are displayed as an inline block and by default such elements have no white space or margin to begin with. You can use below method to avoid this.

What I have done is added a class to the parent element of the buttons and inherit style to class “btn”.

html

<div class="container">
    <div class="row">
        <div class="col-xs-12 button-wrapper">
            <button class="btn btn-primary">Lorem ipsum dolor sit amet</button>
            <button class="btn btn-info">consectetur adipiscing elit</button>
            <button class="btn btn-success">sed do eiusmod tempor incididunt</button>
        </div>
    </div>
</div>

css

.button-wrapper .btn {
    margin-bottom:5px;
}

Demo

Leave a Comment

tech