0

I'm working with bootstrap navbar and everything is fine, but when I call include function on php to call the navbar I see a gap between top of the page and navbar. What happend?

This is the index.php

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="assets/css/bootstrap.css" rel="stylesheet">
<style type="text/css">
body {
    padding-top: 60px;
    padding-bottom: 40px;
}
.sidebar-nav {
    padding: 9px 0;
}
@media (max-width: 768px) {
body {
  padding-top: 0;
    }
}
</style>

<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">

This is navbar.php:

<div class="navbar navbar-inverse navbar-fixed-top">
  <div class="navbar-inner">
    <div class="container">
      <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
  </button>
  <a class="brand" href="#">Project name</a>
  <div class="nav-collapse collapse">
    <ul class="nav">
          <li class="active"><a href="#">Home</a></li>
          <li><a href="#about">About</a></li>
          <li><a href="#contact">Contact</a></li>
    </ul>
  </div>
</div>

When I call in the index.php:

<?php include('navbar.php'); ?>

There is a space in between navbar and top page. If I paste the navbar code in the index.php everything goes fine.

4

0 回答 0