Problem:
Remove padding/margin to the right and left of col-md-* in Bootstrap 3.
HTML code:
<div class="col-md-12"> <h2>OntoExplorer<span style="color:#b92429">.</span></h2> <div class="col-md-4"> <div class="widget"> <div class="widget-header"> <h3>Dimensions</h3> </div> <div class="widget-content" id=""> <div id='jqxWidget'> <div style="clear:both;margin-bottom:20px;" id="listBoxA"></div> <div style="clear:both;" id="listBoxB"></div> </div> </div> </div> </div> <div class="col-md-8"> <div class="widget"> <div class="widget-header"> <h3>Results</h3> </div> <div class="widget-content"> <div id="map_canvas" style="height: 362px;"></div> </div> </div> </div> </div>
Desired output:
Currently this code adds padding/margin to the right and left of the two columns. I am wondering what it is I am missing in order to remove this extra space on the sides?
Notice:
If I remove "col-md-4" then both columns expand to 100% but I want them to be next to each other.
Bootstrap includes a wide range of shorthand responsive margin and padding utility classes to modify an element's appearance.
No gutters The gutters between columns in our predefined grid classes can be removed with . g-0 . This removes the negative margin s from . row and the horizontal padding from all immediate children columns.
By default, Bootstrap 4 has class=”no-gutters” to remove gutter spaces of any specific div. The following image shows the highlighted gutter space and space between columns on bootstrap 4 12 column grid system. You can even modify gutter width by reducing 15px width of gutter space between each columns.
You'd normally use .row
to wrap two columns, not .col-md-12
- that's a column encasing another column. Afterall, .row
doesn't have the extra margins and padding that a col-md-12
would bring and also discounts the space that a column would introduce with negative left & right margins.
<div class="container"> <div class="row"> <h2>OntoExplorer<span style="color:#b92429">.</span></h2> <div class="col-md-4 nopadding"> <div class="widget"> <div class="widget-header"> <h3>Dimensions</h3> </div> <div class="widget-content"> </div> </div> </div> <div class="col-md-8 nopadding"> <div class="widget"> <div class="widget-header"> <h3>Results</h3> </div> <div class="widget-content"> </div> </div> </div> </div> </div>
if you really wanted to remove the padding/margins, add a class to filter out the margins/paddings for each child column.
.nopadding { padding: 0 !important; margin: 0 !important; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With