问答详情
源自:3-1 导航及下拉菜单制作

我也是导航条覆盖下面内容 的问题,

但复制了老师的那行代码也不行:<style>
    body{
    padding-top:50px;
}
</style>

这是怎麽回事?

全部代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<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>Bootstrap 101 Template</title>

    <link href="file:///E|/网页(设计大赛)/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
    body{
    padding-top:50px;
}
</style>

  </head>
<body>
<nav class="navbar navbar-default navbar-fixed-top navbar-inverse" role="navigation">
  <div class="container-fluid">
 
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">Brand</a>
    </div>

   
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">Link</a></li>
        <li><a href="#">Link</a></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <span class="caret"></span></a>
          <ul class="dropdown-menu" role="menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li class="divider"></li>
            <li><a href="#">Separated link</a></li>
            <li class="divider"></li>
            <li><a href="#">One more separated link</a></li>
          </ul>
        </li>
      </ul>
  
    </div>
  </div>
</nav>
<p>2876316731904676776679444</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>

   <p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731904676776679</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>

   <p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<p>2876316731909</p>
<script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>
  
 <script src="file:///E|/网页(设计大赛)/dist/js/bootstrap.min.js"></script>
</body>
</html>


提问者:用户5571574091 2016-11-09 23:41

个回答

  • ras
    2016-11-12 17:43:34
    已采纳

    复制你的代码,在我这边测试没问题,可能是浏览器问题,或者是你引入css的问题