让导航条固定在顶部给body设置了padding-top:70px 为啥还是会遮住内容呢?请大家复制我的代码帮我看一下谢谢了

来源:-

慕粉笑眯眯爱生活

2016-10-15 15:43

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>现代浏览器博物馆</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <!--[if lt IE 9]>
      <script src="js/html5shiv.js"></script>
      <script src="js/respond.min.js"></script>
    <![endif]-->
    <style>
       body{
           padding-top:70px;
       }
    </style>
  </head>
  <body>
   <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
  <div>
    <!-- Brand and toggle get grouped for better mobile display -->
    <div>
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span>Toggle navigation</span>
        <span></span>
        <span></span>
        <span></span>
      </button>
      <a href="#">现代浏览器博物馆</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li><a href="#">综述</a></li>
        <li><a href="#">简述</a></li>
        <li>
          <a href="#" data-toggle="dropdown">特点 <span></span></a>
          <ul role="menu">
            <li><a href="#feature-tab" data-tab="tab-chrome">Chrome</a></li>
            <li><a href="#feature-tab" data-tab="tab-firefox">Firefox</a></li>
            <li><a href="#feature-tab" data-tab="tab-safari">Safari</a></li>
            <li><a href="#feature-tab" data-tab="tab-opera">Opera</a></li>
            <li><a href="#feature-tab" data-tab="tab-ie">IE</a></li>
          </ul>
        </li>
        <li><a href="#">关于</a></li>
      </ul>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>
<p>dfghjkjhgfds</p>
<p>1111111111111</p>
<p>2222222222222222222222</p>
<p>dfghjkjhgfds</p>
<p>1111111111111</p>
<p>2222222222222222222222</p>
<p>dfghjkjhgfds</p>
<p>1111111111111</p>
<p>2222222222222222222222</p>
<p>dfghjkjhgfds</p>
<p>1111111111111</p>
<p>2222222222222222222222</p>
<p>dfghjkjhgfds</p>
<p>1111111111111</p>
<p>2222222222222222222222</p>
<p>dfghjkjhgfds</p>
<p>1111111111111</p>
<p>2222222222222222222222</p>
<p>dfghjkjhgfds</p>
<p>1111111111111</p>
<p>2222222222222222222222</p>
<p>dfghjkjhgfds</p>
<p>1111111111111</p>
<p>2222222222222222222222</p>
<p>dfghjkjhgfds</p>
<p>1111111111111</p>
<p>2222222222222222222222</p>
<p>dfghjkjhgfds</p>
<p>1111111111111</p>
<p>2222222222222222222222</p>
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery-1.11.1.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>

写回答 关注

1回答

  • 口袋有糖
    2017-03-28 20:17:53

    注意navbar-fixed-top吸顶导航条

基于bootstrap的网页开发

Bootstrap框架的基础教程,学会用Bootstrap前端框架搭建网页

187669 学习 · 734 问题

查看课程

相似问题