Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove spacing between cols

I want to remove the space between multiple columns in the Bootstrap grid.

How can we overwrite Bootstrap's CSS to achieve this task or any other better solution with pure CSS?

main.html

<div class="row">   <div class="col-md-2">     // stuff here for this column   </div>   <div class="col-md-10">     // stuff here for columns   </div> </div> 
like image 321
hussain Avatar asked Oct 26 '16 16:10

hussain


People also ask

How can I remove space between two div tags in bootstrap?

You can add new class to your div elements and remove padding/margin with css. To make it more clear, bootstrap assigns margin-left: -15px and margin-right: -15px for . row selector and padding-left: 15px and padding-right: 15px on all . col-* selectors to get 30px space between all the cols.

How do I remove spaces between bootstrap rows?

If you want to use bootstrap to control line spacing it is recommended to use the margin and padding settings in bootstrap. i.e. my-0 and py-0.


1 Answers

add a class when you need to remove spaces use it

.padding-0{     padding-right:0;     padding-left:0; } 

in html write this class

<div class="row">    <div class="col-md-2 padding-0">        //stuff here for this column    </div>    <div class="col-md-10 padding-0">        //stuff here for columns    </div> </div> 
like image 123
Morteza Negahi Avatar answered Sep 22 '22 09:09

Morteza Negahi