Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

WordPress

Wordpresss navbar spacing problems

I am trying to style my Nav links but there is weird spacing between my links. I can't figure out what it is. Here is my code:

<header> <div class='container static-nav'> <div class='col-sm-5'>

    </div>
    <div class='col-sm-7 main-nav'>  
      <nav class="nav-collapse">
            <?php 
              $args = array(
                'menu'        => 'header-menu',
                'menu_class'  => '',
                'container'   => 'false'
              );
              wp_nav_menu( $args );
            ?>
      </nav>
    </div>
  </div>
</header>

My CSS:

@media (min-width: 768px) {
.static-nav{
  position:fixed
  top:0px;
  left:0px;
  height:60px;
  width:100%;
  margin:0;
  padding:0;
  z-index:999;
  overflow:hidden;
  background: #fff;
  color: #fff;
}
.main-nav{
  height: 100%;
}
.main-nav ul{
  float: right;
  width: auto;
}
.main-nav ul li{
  display: inline-block;
  width: auto;
  height: 100%;
  background: #333;
  margin: 0;
}
.main-nav ul li a{
  line-height: 60px;
  padding: 1em;
  color: #fff;
}

@media (max-width: 768px){
.container > .main-nav{
  margin: 0px;
  padding: 0px;
}
}

The weird spacing is shown here: https://photos-2.dropbox.com/t/2/AAAlkyS__VaYuee1L1bNFYqnayZH4eLPUwk7PkYuKJg3ew/12/380097602/jpeg/1024x768/3/1429758000/0/2/Untitled-1.jpg/CMKon7UBIAEgAiADKAE/x5U3IrfMNfo43sR8lzkW52rApy0568swGNRsUrAK1-k

Hi Brennan,

The drop box link gives a 404 error.

Are you using bootstrap here?

What is this weird spacing issue? Do you have gaps between your list items that are about 4 or 5px?

1 Answer

Exactly! I fixed it by giving the ul a font-size 0 and it seemed to fix it.