Bootstrap 4 container fluid extra margin


Pierre

I am using Bootstrap 4.2 to write a page in html. I would like to have a horizontal navbar at the top of the page that takes the full width of the page and remains static during navigation.

I am trying to use some divs in the class "container-fluid". The problem is that whitespace appears on the left and right of the bar graph

Here is the example I got in jsfiddle

<div class="container-fluid">
      <div class="sticky-top shadow" id="containerMain">
        <div class="container-fluid bg-secondary text-light p-1">
          <div class="row align-items-center ">
            Line number one content here
          </div>
        </div>
        <div class="container-fluid filters bg-light align-items-center">
          <div class="row p-1">
            Line number two content here
          </div>
        </div>
      </div>
    </div>

Does anyone know how to make these extra whitespace disappear? I tried it without the "container fluid" class, but then the margins appear to the right and I don't want horizontal scrolling either.

Thank you very much in advance,

lac

The padding-left and padding-right of container-fluid are 15px and 15px respectively. You can override this by adding a class that px-0pads 0s for the left and right . Then you will have to use a mx-0class to override the 15px margin of the line .

However, if you want to use it, you should use Bootstrap's nav components : https://getbootstrap.com/docs/4.1/components/navbar/

Related


Bootstrap 4 container fluid extra margin

Pierre I am using Bootstrap 4.2 to write a page in html. I would like to have a horizontal navbar at the top of the page that takes the full width of the page and remains static during navigation. I am trying to use some divs in the class "container-fluid". Th

Bootstrap Container Fluid Carousel

Sonia Maklouf I was surprised, I thought using container fluid would give me a full width carousel, but it doesn't. It has a padding of around 15 px, so I added a new class remove-padding so that there is no padding, but it didn't work. Any ideas for a carouse

Cant seems to get rid of fluid container filling in Bootstrap 4

Brett Williams So I'm trying to add a full width (not full screen) video under the navbar using Bootstrap 4, but I can't seem to get rid of these white stripes (padding I think) on the sides. <body> <!-- body code goes here --> <div id="top-nav-fluid" clas

Bootstrap 4 how to vertically align inside container fluid

João Moreira I'm trying to vertically align two lines in a container fluid that are already horizontally aligned. The goal is to place it in the middle of the screen. <!DOCTYPE html> <html lang="en"> <head> <!-- Required meta tags --> <meta

Cant seems to get rid of fluid container filling in Bootstrap 4

Brett Williams So I'm trying to add a full width (not full screen) video under the navbar using Bootstrap 4, but I can't seem to get rid of these white stripes (padding I think) on the sides. <body> <!-- body code goes here --> <div id="top-nav-fluid" clas

Cant seems to get rid of fluid container filling in Bootstrap 4

Brett Williams So I'm trying to add a full width (not full screen) video under the navbar using Bootstrap 4, but I can't seem to get rid of these white stripes (padding I think) on the sides. <body> <!-- body code goes here --> <div id="top-nav-fluid" clas

Cant seems to get rid of fluid container filling in Bootstrap 4

Brett Williams So I'm trying to add a full width (not full screen) video under the navbar using Bootstrap 4, but I can't seem to get rid of these white stripes (padding I think) on the sides. <body> <!-- body code goes here --> <div id="top-nav-fluid" clas

Cant seems to get rid of fluid container filling in Bootstrap 4

Brett Williams So I'm trying to add a full width (not full screen) video under the navbar using Bootstrap 4, but I can't seem to get rid of these white stripes (padding I think) on the sides. <body> <!-- body code goes here --> <div id="top-nav-fluid" clas

Cant seems to get rid of fluid container filling in Bootstrap 4

Brett Williams So I'm trying to add a full width (not full screen) video under the navbar using Bootstrap 4, but I can't seem to get rid of these white stripes (padding I think) on the sides. <body> <!-- body code goes here --> <div id="top-nav-fluid" clas

Cant seems to get rid of fluid container filling in Bootstrap 4

Brett Williams So I'm trying to add a full width (not full screen) video under the navbar using Bootstrap 4, but I can't seem to get rid of these white stripes (padding I think) on the sides. <body> <!-- body code goes here --> <div id="top-nav-fluid" clas

Cant seems to get rid of fluid container filling in Bootstrap 4

Brett Williams So I'm trying to add a full width (not full screen) video under the navbar using Bootstrap 4, but I can't seem to get rid of these white stripes (padding I think) on the sides. <body> <!-- body code goes here --> <div id="top-nav-fluid" clas

Cant seems to get rid of fluid container filling in Bootstrap 4

Brett Williams So I'm trying to add a full width (not full screen) video under the navbar using Bootstrap 4, but I can't seem to get rid of these white stripes (padding I think) on the sides. <body> <!-- body code goes here --> <div id="top-nav-fluid" clas

Cant seems to get rid of fluid container filling in Bootstrap 4

Brett Williams So I'm trying to add a full width (not full screen) video under the navbar using Bootstrap 4, but I can't seem to get rid of these white stripes (padding I think) on the sides. <body> <!-- body code goes here --> <div id="top-nav-fluid" clas

Cant seems to get rid of fluid container filling in Bootstrap 4

Brett Williams So I'm trying to add a full width (not full screen) video under the navbar using Bootstrap 4, but I can't seem to get rid of these white stripes (padding I think) on the sides. <body> <!-- body code goes here --> <div id="top-nav-fluid" clas

Cant seems to get rid of fluid container filling in Bootstrap 4

Brett Williams So I'm trying to add a full width (not full screen) video under the navbar using Bootstrap 4, but I can't seem to get rid of these white stripes (padding I think) on the sides. <body> <!-- body code goes here --> <div id="top-nav-fluid" clas

Cant seems to get rid of fluid container filling in Bootstrap 4

Brett Williams So I'm trying to add a full width (not full screen) video under the navbar using Bootstrap 4, but I can't seem to get rid of these white stripes (padding I think) on the sides. <body> <!-- body code goes here --> <div id="top-nav-fluid" clas

Bootstrap 4 how to vertically align inside container fluid

João Moreira I'm trying to vertically align two lines in a container fluid that are already horizontally aligned. The goal is to place it in the middle of the screen. <!DOCTYPE html> <html lang="en"> <head> <!-- Required meta tags --> <meta