E
E
Eugene M2021-03-28 14:29:09
Bootstrap
Eugene M, 2021-03-28 14:29:09

How to remove padding from container-fluid in bootstrap5?

I'm using the container-fluid class to make the grid the full width of the screen! BUT there is one drawback! The padding on the container-fluid element is padded from the edge so the background doesn't fill flush to the screen! It is possible to override the .container-fluid {padding: 0} class, but I want to know if there is a built-in class or method for this?

606068618af07082283744.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri, 2021-03-28
@cheeroque

Bootstrap has a whole set of utility classes for resetting/redefining indentation . Specifically, for setting zero padding, there are .p-0also its responsive counterparts, with breakpoints.
But in your case, as already correctly said above, the container is simply not needed. However, in order to avoid horizontal scrolling due to negative padding on .row, you will have to add the parent .overflow-hidden.

E
Eugene M, 2021-04-18
@hotwind

I figured out how to do this using the bootstrap px-0 and m-0 classes, they need to be added in 2 places. But how to stretch the right section to the end of the screen?
607bbad462fde733662312.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question