Skip to main content
Known Participant
September 2, 2015
Question

How do I get rid of extra white space between nav and next div?

  • September 2, 2015
  • 3 replies
  • 20602 views

How do I get rid of the white space after the nav bar in Dreamweaver CC?

The code (without all the nav links) is:

<div class="container-fluid" id="wrapper">

   

  <!-- Header --> 

    <header>

  <div class="row"><img src="images/header.jpg" class="center-block image-fill" alt="Kairos Prison Ministry"></div>

</header>

<!-- Navigation -->   

<nav class="navbar navbar-default dkblue col-lg-8 col-lg-offset-0">

    <!-- Brand and toggle get grouped for better mobile display -->

    <div class="navbar-header">

      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#defaultNavbar1"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>

</div>

    <!-- Collect the nav links, forms, and other content for toggling -->

    <div class="collapse navbar-collapse dkblue" id="defaultNavbar1">

      <ul class="nav navbar-nav bg-primary">

       

        <li> </li>

        <li> </li>

        <li><a href="#" class="whitetext">Home</a></li><li><a href="#" class="whitetext">Home</a></li>

        <li class="dropdown"><a href="#" class="dropdown-toggle whitetext" data-toggle="dropdown" role="button" aria-expanded="false">About Us<span class="caret"></span></a>

          <ul class="dropdown-menu" role="menu">

           

            <li><a href="#">Our Core Values</a></li>

          </ul>

      </ul>

    

     

    <!-- /.navbar-collapse -->

  </div>

  <!-- /.container-fluid -->

</nav>

</div>

       <!-- Header Image -->

  <div class="container center-block image-fill">

  <div class="row"><img src="images/headerimg.png" class="center-block image-fill" alt="" style="display:block;"></div>

</div>

Thanks!

Deborah

This topic has been closed for replies.

3 replies

Diego_Maradona
New Participant
October 9, 2015

Hi,

When you use Insert --> Bootstrap Components --> Navbar: Navbar fixed to top, Dreamweaver change Source Code from <body> to <body style="padding-top: 70px">. I set padding-top from there (Source Code) and it works.

Thanks.

Nancy OShea
Community Expert
September 2, 2015

Bootstrap's navbar has padding and possibly margins on the bottom.  Try to zero it out.

View your site in a good browser like FF, Chrome, Safari and use the Inspect Element feature to show you what Bootstrap is doing to the navbar.

Nancy O.

Nancy O'Shea— Product User, Community Expert & Moderator
kpmiAuthor
Known Participant
September 3, 2015

I was able to find and correct the navbar padding. Thanks so much!

sinious
Brainiac
September 3, 2015

How did you end up fixing it? Was it the margin collapse or just adjusting bootstraps padding under the nav?

Jon Fritz
Community Expert
September 2, 2015

That's usually a case of margin-collapse in the content under the nav bar.

Since you didn't post that part, I'm not 100% sure, but if you don't have something between the margin of a child element and the margin of its parent, the margins will collapse and end up on the parent element (probably where your background image is) and appear as a space.

Usually it's a <p> or <h1> tag's browser default margin that causes it.

Do you have a link you could share of your page so we could take a look in the browser?

Here's a more long-winded explanation (scroll down to the child/parent part): Collapsing Margins - SitePoint