How to remove the gap between the navbar and the container fluid?


Gecko

Here is my situation : http://codepen.io/gkos/pen/LxmrMP?editors=1100

<header>
  <nav class="navbar navbar-default">
    <div class="container-fluid">
      <ul class="nav navbar-nav">
        <li class="navbar-text">Item</li>
        <li class="navbar-text">Item</li>
        <li class="navbar-text">Item</li>
        <li class="navbar-text">Item</li>
      </ul>
    </div>
  </nav>
</header>
<div class="site-content container-fluid">
  <div class="row">
      <div class="col-md-9">
        <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
    </div>
    <div class="col-md-3 site-sidebar">
      <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
    </div>
  </div>
</div>

<footer>
  <div class="container-fluid">
    <div class="row navbar navbar-default">
      <div class="col-md-4"><p class="navbar-text">Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p></div>
      <div class="col-md-4"><p class="navbar-text">Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p></div>
      <div class="col-md-4"><p class="navbar-text">Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p></div>
    </div>
  </div>
</footer>

I have a navbar, a container fluid with two collons. There is a gap between the navbar and the container displayed in blue (body background color), how can I remove the bar so that the column background color fills from the navbar to the footer without a gap? I know about margin trading but can't find the applicable margin bean....

Using negative margins in the site content class removes the gap, but I have to hardcode the gap height in pixels, which doesn't seem like the right answer!

.site-content
  margin-top: -21px

greeting

Andrew L64

The navbarclass has a default margin-bottom:20pxbootstrap CSS. You can override it by adding:

.navbar {
    margin-bottom: 0px;
}

Note : Make sure the above css properties are below bootstrap default css.

Related


How to remove the gap at the top of the navbar?

tobit The gap is somehow connected to the back function. If I pull down the navbar, the app goes back to the last view, but I don't want the option to go back to the view. I don't know where to search for it. If the picture doesn't work. Here is the link : htt

How to remove the gap at the top of the navbar?

tobit The gap is somehow connected to the back function. If I pull down the navbar, the app goes back to the last view, but I don't want the option to go back to the view. I don't know where to search for it. If the picture doesn't work. Here is the link : htt

How to remove spacing between elements inside ".container-fluid"?

Zeinab Here, I'm creating a header display: flex;so that the element is perfectly centered horizontally within it, not vertically. If I don't use bootstrap, everything runs correctly, but as soon as I add the bootstrap CSS to my HTML, they just jump into the c

How to remove spacing between elements inside ".container-fluid"?

Zeinab Here, I'm creating a header display: flex;so that the element is perfectly centered horizontally within it, not vertically. If I don't use bootstrap, everything runs correctly, but as soon as I add the bootstrap CSS to my HTML, they just jump into the c

How to remove spacing between elements inside ".container-fluid"?

Zeinab Here, I'm creating a header display: flex;so that the element is perfectly centered horizontally within it, not vertically. If not using bootstrap, everything runs correctly, but as soon as I add the bootstrap CSS to my HTML, they just jump into the cen

How to remove spacing between elements inside ".container-fluid"?

Zeinab Here, I'm creating a header display: flex;so that the element is perfectly centered horizontally within it, not vertically. If I don't use bootstrap, everything runs correctly, but as soon as I add the bootstrap CSS to my HTML, they just jump into the c

How to remove spacing between elements inside ".container-fluid"?

Zeinab Here, I'm creating a header display: flex;so that the element is perfectly centered horizontally within it, not vertically. If I don't use bootstrap, everything runs correctly, but as soon as I add the bootstrap CSS to my HTML, they just jump into the c

How to remove spacing between elements inside ".container-fluid"?

Zeinab Here, I'm creating a header display: flex;so that the element is perfectly centered horizontally within it, not vertically. If I don't use bootstrap, everything runs correctly, but as soon as I add the bootstrap CSS to my HTML, they just jump into the c

How to remove the gap between inner div and container div?

eager I can't seem to figure out why my room and online users divs are not the same width (evenly spaced). Also for some reason there is a gap between each of them and the container div. For example, on the left side of the "Rooms" div, the whitespace is white

How to remove the gap between inner div and container div?

eager I can't seem to figure out why my room and online users divs are not the same width (evenly spaced). Also for some reason there is a gap between each of them and the container div. For example, on the left side of the "Rooms" div, the whitespace is white

How to remove the gap between inner div and container div?

eager I can't seem to figure out why my room and online users divs are not the same width (evenly spaced). Also for some reason there is a gap between each of them and the container div. For example, on the left side of the "Rooms" div, the whitespace is white

How to remove the gap between inner div and container div?

eager I can't seem to figure out why my room and online users divs are not the same width (evenly spaced). Also for some reason there is a gap between each of them and the container div. For example, on the left side of the "Rooms" div, the whitespace is white

How to clear the gap between header and navbar?

jsjsjs There's a weird gap between the header image and the navbar and I don't know how to remove it! The problem code itself . <!-- some css settings --> #banner { width: 100%; height: 100px; margin-bottom: 0; margin-top: 0; } #nav_bar {

How to close the gap between objects in the navbar list?

Heber I'm trying to replicate apple.com's navbar. But I'm running into an issue where the list spreads far beyond the actual website. I would like to know what is causing this? I've tried margin/paddingthis list and it's the best I can think of. If the above d

How to fill the gap between navbar and div

User 9430427 Here I am new to Bootstrap please help me how to close the gap between navbar and div [![<nav class="navbar navbar-default"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" hre

How to clear the gap between header and navbar?

jsjsjs There's a weird gap between the header image and the navbar and I don't know how to remove it! The problem code itself . <!-- some css settings --> #banner { width: 100%; height: 100px; margin-bottom: 0; margin-top: 0; } #nav_bar {

How to clear the gap between header and navbar?

jsjsjs There's a weird gap between the header image and the navbar and I don't know how to remove it! The problem code itself . <!-- some css settings --> #banner { width: 100%; height: 100px; margin-bottom: 0; margin-top: 0; } #nav_bar {

How to close the gap between objects in the navbar list?

Heber I'm trying to replicate apple.com's navbar. But I'm running into an issue where the list spreads far beyond the actual website. I would like to know what is causing this? I've tried margin/paddingthis list and it's the best I can think of. If the above d

How to close the gap between objects in the navbar list?

Heber I'm trying to replicate apple.com's navbar. But I'm running into an issue where the list spreads far beyond the actual website. I would like to know what is causing this? I've tried margin/paddingthis list and it's the best I can think of. If the above d

How to clear the gap between header and navbar?

jsjsjs There's a weird gap between the header image and the navbar and I don't know how to remove it! The problem code itself . <!-- some css settings --> #banner { width: 100%; height: 100px; margin-bottom: 0; margin-top: 0; } #nav_bar {

How to clear the gap between header and navbar?

jsjsjs There's a weird gap between the header image and the navbar and I don't know how to remove it! The problem code itself . <!-- some css settings --> #banner { width: 100%; height: 100px; margin-bottom: 0; margin-top: 0; } #nav_bar {

How to clear the gap between header and navbar?

jsjsjs There's a weird gap between the header image and the navbar and I don't know how to remove it! The problem code itself . <!-- some css settings --> #banner { width: 100%; height: 100px; margin-bottom: 0; margin-top: 0; } #nav_bar {

How to close the gap between objects in the navbar list?

Heber I'm trying to replicate apple.com's navbar. But I'm running into an issue where the list spreads far beyond the actual website. I would like to know what is causing this? I've tried margin/paddingthis list and it's the best I can think of. If the above d

How to close the gap between objects in the navbar list?

Heber I'm trying to replicate apple.com's navbar. But I'm running into an issue where the list spreads far beyond the actual website. I would like to know what is causing this? I've tried margin/paddingthis list and it's the best I can think of. If the above d