Optionally Remove the Gutter Padding from Columns

Optionally Remove the Gutter Padding from Columns

HTML:

<h1>CSS Helper for Gutterless <strong>Bootstrap 3</strong> Columns <i class="fa fa-heart"></i></h1>

<div class="container">
 <div class="row">
 <h2>With Gutter</h2>
 <div class="col-sm-4">
 <a href="#" class="btn btn-block btn-primary">Full width Button</a>
 </div>
 <div class="col-sm-4">
 <a href="#" class="btn btn-block btn-primary">Full width Button</a>
 </div>
 <div class="col-sm-4">
 <a href="#" class="btn btn-block btn-primary">Full width Button</a>
 </div>
 </div>
</div>

<div class="container">
 <div class="row no-gutter">
 <h2>Without Gutter</h2>
 <div class="col-sm-4">
 <a href="#" class="btn btn-block btn-primary">Full width Button</a>
 </div>
 <div class="col-sm-4">
 <a href="#" class="btn btn-block btn-primary">Full width Button</a>
 </div>
 <div class="col-sm-4">
 <a href="#" class="btn btn-block btn-primary">Full width Button</a>
 </div>
 </div>

</div>

CSS:

/*======================================
= NO GUTTER CODE =
======================================*/
.no-gutter > [class*='col-'] {
 padding-right:0;
 padding-left:0;
}

/*=========================================
= IGNORE - USED FOR LAYOUT =
=========================================*/
h1 { margin-bottom: 50px; }
h1, h2 { text-align: center; }
.container {
 background: #e3e3e3;
 margin-bottom: 20px;
 padding-bottom: 50px;
}
p {
 background: pink;
 margin: 0;
}
i {
 color: pink;
}

source: https://codepen.io/ncerminara/pen/hfvix/

Leave a Reply

Your email address will not be published. Required fields are marked *