导航栏位置4

时间:2016-11-02 08:34:28

标签: html css twitter-bootstrap

即使我已经指定了navbar-right,徽标和li也更接近中心。在我的Mac 13'看起来不错,但在办公室的电脑上看起来不同。此外,图片并未真正响应,.img-responsive也没有做任何事情。



.navbar {
   min-height: 80px;
   margin-bottom: 0;
}
#btnnavbar {
   margin-top: 20px;
}

#btnhome {
   margin-top: 16px;
}

#imgbrand {
   margin-top: -70px;
   margin-left: px;
   height: 220px;
   width: 280px;
}

#firstpage {
   margin-top: 90px;
}

.button {
   color: blue;
}

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
         <head>
         </head>
          <body>
            <!-- Navbar style available in Bootstrap framework-->
            <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
              <!-- /end-->
              <!-- Anything that has to be responsive we are going to keep inside the Bootstrap grid -->
              <div class="container">
                <!-- /end -->
                <div class="navbar-header">
                  
                  <button type="button" class="navbar-toggle btn-lg" data-toggle="collapse" data-target=".navbar-collapse" id="btnnavbar">
              <!-- For screen readers only -->
              <span class="sr-only">Toggle navigation</span>
               <!-- /end -->
               <!-- Hamburger menu button appears when browser window has been shrinked -->
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              </button>
              <!-- /end -->
              <!-- Brand and toggle get grouped for better mobile display -->
              <a class="navbar-brand " href="http://codepen.io/ekilja01"><img class="img-responsive" id="imgbrand" src="http://www.kiljakandweb.com/favicon.png" alt="brand logo"></a>
                  
                </div>
                
                <div class="navbar-collapse collapse">
                  <ul class="nav navbar-nav navbar-right">
                    <li id="btnhome"><a href="#">About</a></li>
                    <li id="btnhome"><a href="#">Portfolio</a></li>
                    <li id="btnhome"><a href="#">Contact</a></li>
                  </ul>
                </div>
            </div>
         
            </div>
        </nav>
             
          
          <div class="container" id="firstpage">
          
                <div class="row">
        <div class="col-md-12">
                <h1 class="text-center">1.4.1.3</h1>
          </div>
          </div>
        </body>
        </html>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:1)

更改课程&#34;容器&#34; Banzay说,在导航栏内容器流体。

&#13;
&#13;
.navbar {
  min-height: 80px;
  margin-bottom: 0;
}
#btnnavbar {
  margin-top: 20px;
}
#btnhome {
  margin-top: 16px;
}
#imgbrand {
  margin-top: -70px;
  margin-left: px;
  height: 220px;
  width: 280px;
}
#firstpage {
  margin-top: 90px;
}
.button {
  color: blue;
}
&#13;
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<html>

<head>
</head>

<body>
  <!-- Navbar style available in Bootstrap framework-->
  <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <!-- /end-->
    <!-- Anything that has to be responsive we are going to keep inside the Bootstrap grid -->
      <!-- /end -->
      <div class="container-fluid">
      <div class="navbar-header">

        <button type="button" class="navbar-toggle btn-lg" data-toggle="collapse" data-target=".navbar-collapse" id="btnnavbar">
          <!-- For screen readers only -->
          <span class="sr-only">Toggle navigation</span>
          <!-- /end -->
          <!-- Hamburger menu button appears when browser window has been shrinked -->
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <!-- /end -->
        <!-- Brand and toggle get grouped for better mobile display -->
        <a class="navbar-brand " href="http://codepen.io/ekilja01">
          <img class="img-responsive" id="imgbrand" src="http://www.kiljakandweb.com/favicon.png" alt="brand logo">
        </a>

      </div>

      <div class="navbar-collapse collapse">
        <ul class="nav navbar-nav navbar-right">
          <li id="btnhome"><a href="#">About</a>
          </li>
          <li id="btnhome"><a href="#">Portfolio</a>
          </li>
          <li id="btnhome"><a href="#">Contact</a>
          </li>
        </ul>
      </div>
    </div>
    </div>
  </nav>


  <div class="container" id="firstpage">

    <div class="row">
      <div class="col-md-12">
        <h1 class="text-center">1.4.1.3</h1>
      </div>
    </div>
</body>

</html>
&#13;
&#13;
&#13;

答案 1 :(得分:1)

我认为用<div class="container">替换<div class="container-fluid">必须解决问题。