0

I love Bootstrap, but I'm no expert nor a front-end developer, and there is a problem I always have with it. See the image below.

enter image description here

For the row and columns of this layout, I use this:

<div class="row">
    <div class="col-md-4">...</div>
    <div class="col-md-4">...</div>
    <div class="col-md-4">...</div>
</div>

Is there any utility class to remove this space in the start and in the end of the row? I would like to make the first and last column to match the red box below.

André Luiz
  • 6,642
  • 9
  • 55
  • 105

2 Answers2

1

In Bootstrap 4 you can use this:

<div class="row">
    <div class="col-md-4 px-0">...</div>
    <div class="col-md-4">...</div>
    <div class="col-md-4 px-0">...</div>
</div>

https://getbootstrap.com/docs/4.3/utilities/spacing/

https://getbootstrap.com/docs/4.3/layout/grid/#gutters

Jakub Muda
  • 6,008
  • 10
  • 37
  • 56
Simon
  • 44
  • 4
0

The utilities classes work but they leave the side elements bigger.

I found a solution for the issue. I embraced everything with a div.items-list and set this styling to it (it's sass)

.items-list{
    [class^="col"]{
        padding-right: 30px;
        padding-left: 0;

        &:nth-child(2n){
            padding-right: 15px;
            padding-left: 15px;
        }

        &:nth-child(3n){
            padding-right: 0;
            padding-left: 30px;
        }
    }
}
André Luiz
  • 6,642
  • 9
  • 55
  • 105