"No Gutter Grid with attribute selectors"
Bootstrap 3.2.0 Snippet by azupan

<link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class='container'> <h1>No Gutter Grid <small>with CSS attribute selectors</small></h1> <p>Best viewed: <a href="http://bootsnipp.com/iframe/eNjV6" target="_blank">full screen</a> </p> <h3>Normal Grid</h3> <div class='row'> <div class='col-sm-3'> <img class='img-responsive' src='//lorempixel.com/400/150/nature/1/' alt=""> </div> <div class='col-sm-3'> <img class='img-responsive' src='//lorempixel.com/400/150/nature/2/' alt=""> </div> <div class='col-sm-3'> <img class='img-responsive' src='//lorempixel.com/400/150/nature/3/' alt=""> </div> <div class='col-sm-3'> <img class='img-responsive' src='//lorempixel.com/400/150/nature/4/' alt=""> </div> </div> <h3>No Gutter Grid</h3> <div class='row row-no-gutter'> <div class='col-sm-3'> <img class='img-responsive' src='//lorempixel.com/400/150/nature/1/' alt=""> </div> <div class='col-sm-3'> <img class='img-responsive' src='//lorempixel.com/400/150/nature/2/' alt=""> </div> <div class='col-sm-3'> <img class='img-responsive' src='//lorempixel.com/400/150/nature/3/' alt=""> </div> <div class='col-sm-3'> <img class='img-responsive' src='//lorempixel.com/400/150/nature/4/' alt=""> </div> <p> <a href="http://validator.w3.org/check?uri=http%3A%2F%2Fbootsnipp.com%2Fiframe%2FeNjV6" target="_blank"><small>HTML</small><sup>5</sup></a> </p> </div> </div>
/* Ref: http://codepen.io/unavezfui/pen/Idyck/ Understanding [class*="col-"] - See line #26 below Attribute selectors allow you to style an element’s box based on the presence of an HTML attribute or of an attribute’s value http://htmldog.com/guides/css/advanced/attributeselectors/ */ body { background-color: #222; color: #ccc; } h3{ color:#fff; } .row-no-gutter { margin-right: 0; margin-left: 0; } .row-no-gutter [class*="col-"] { padding-right: 0; padding-left: 0; }

Related: See More


Questions / Comments: