bootstrap 4导航栏的左侧和右侧都有填充

时间:2018-10-21 01:37:52

标签: html5 bootstrap-4 navbar

我不确定我在这里缺少什么,我知道我可以添加CSS来删除父div的填充,但是我认为引导程序会使导航栏变成页面的整个宽度吗?这是我的代码:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Contact</title>
    <!--Bootstrap CSS-->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
    <link rel="stylesheet" type="text/css" media="screen" href="main.css" />
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  </head>

<body>
  <div class="container-fluid" id="outer">
    <header>
      <nav class="navbar navbar-expand-lg navbar-light bg-secondary">
        <a class="navbar-brand" href="#">
                        <img src="\movieTheater.jpg" width="10%" height="10%" alt=""> Movie Theater
                    </a>
        <div class="collapse navbar-collapse" id="navbarNav">
          <ul class="navbar-nav ml-auto">
            <li class="nav-item active">
              <a class="nav-link" href="home.html">Home</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="about.html">About</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="contact.html">Contact</a>
            </li>
          </ul>
        </div>
      </nav>
    </header>
  </div>
</body>

</html>

1 个答案:

答案 0 :(得分:2)

容器流体类的宽度为100%,但已应用了一些填充,要删除填充,可以在特殊情况下使用Bootsrap中的 pX 类,这将是 p-0 。您可以检查下一个示例。另外,我还添加了collpased菜单按钮,如果您不包含它,折叠时导航栏将无法正常工作。

sudo apt-get remove --purge libcrypto++ libcrypto++-dev libcrypto++-dbg