Am building a simple landing page using bootstrap. I need to increase column gap in the row. I know we can increase the gap by customizing sass spacing mixin but since website am building includes couple of sections I want to keep it simple without build process. I have used g-5 classname on row which gives like 32px or 40px gap between columns. How to increase it further using CSS.
<div class="container mt-5 pt-5">
<div class="row text-light g-5 fs-1">
<div class="col-lg-4">
<div class="bg-dark p-5">column</div>
</div>
<div class="col-lg-4">
<div class="bg-dark p-5">column</div>
</div>
<div class="col-lg-4">
<div class="bg-dark p-5">column</div>
</div>
</div>
</div>
2
Answers
To increase the gap between Bootstrap columns without using custom SASS or a build process, you can apply some custom CSS.
In this solution, I’ve added a negative horizontal margin to the .custom-gap-row class and corresponding padding to the .col-lg-4 elements. This creates the illusion of increased spacing between columns while keeping them within the same row and maintaining the layout.
You can adjust the negative margin value as needed to control the gap between columns.
To increase the column gap in the row using CSS, you can use the grid-column-gap property. This property specifies the space between columns in a grid layout.