jumbotron顶部的Bootstrap Navbar(覆盖)

时间:2018-04-10 15:06:28

标签: html css twitter-bootstrap bootstrap-4 navbar

我正在尝试将我的导航栏放在我的Jumbotron封面上(我正在使用Bootstrap CSS),但我无法将它(导航栏)放置在Jumbotron顶部,具有透明背景。

帮助将不胜感激: - )

以下是我的HTML代码:

<nav class="navbar navbar-expand-md navbar-light">
<div class="navbar-collapse collapse w-100 order-1 order-md-0 dual-collapse2">
    <ul class="navbar-nav mr-auto">
        <li class="nav-item active">
            <a class="nav-link" href="/home.php">Item 1</a></a>
        </li>
        <li class="nav-item">
            <a class="nav-link" href="">Item 2</a>
        </li>
    </ul>
</div>

<div class="mx-auto order-0">
    <a class="navbar-brand mx-auto" href="/home.php">
      <img src="/images/logo.svgs" height="35" alt="">Logo
    </a>
</div>

<div class="navbar-collapse collapse w-100 order-3 dual-collapse2">
    <ul class="navbar-nav ml-auto">
        <li class="nav-item">
            <a class="nav-link" href="#">Page 1</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" href="#">Page 2</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" href="#">Page 3</a>
        </li>
    </ul>
</div>
</nav>

<section class="cover jumbotron jumbotron-fluid" id="cover">
<div class="container-fluid">
  <div class="row">
    <div class="cover-text col-5">
      <h1 class="display-4">LOREM IPSUM TITLE</h1>
      <p class="lead">
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce
        convallis pellentesque metus id lacinia.
      </p>
    </div>

    <div class="col-1">
    </div>

    <div class="col-6">
      <div class="card">
        <div class="card-body">
          <h5 class="card-title">Card title</h5>
          <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
          <p class="card-text">
            Some quick example text to build on the card title and make up
            the bulk of the card's content.
          </p>
          <a href="#" class="card-link">Card link</a>
        </div>
      </div>
    </div>
  </div>
</div>
</section>

以下是它的外观图片: home-page

2 个答案:

答案 0 :(得分:0)

您还没有关闭导航部分。 这可能会导致不必要的问题。

答案 1 :(得分:0)

fixed-top导航栏用作explained in the docs ...

<nav class="navbar navbar-expand-md navbar-light fixed-top">
    <div class="navbar-collapse collapse w-100 order-1 order-md-0 dual-collapse2">
        <ul class="navbar-nav mr-auto">
            <li class="nav-item active">
                <a class="nav-link" href="/home.php">Item 1</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="">Item 2</a>
            </li>
        </ul>
    </div>

    <div class="mx-auto order-0">
        <a class="navbar-brand mx-auto" href="/home.php">
            <img src="/images/logo.svgs" height="35" alt="">Logo
        </a>
    </div>

    <div class="navbar-collapse collapse w-100 order-3 dual-collapse2">
        <ul class="navbar-nav ml-auto">
            <li class="nav-item">
                <a class="nav-link" href="#">Page 1</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">Page 2</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">Page 3</a>
            </li>
        </ul>
    </div>
</nav>

<section class="cover jumbotron jumbotron-fluid" id="cover">
    <div class="container-fluid">
        <div class="row">
            <div class="cover-text col-5">
                <h1 class="display-4">LOREM IPSUM TITLE</h1>
                <p class="lead">
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce convallis pellentesque metus id lacinia.
                </p>
            </div>

            <div class="col-1">
            </div>

            <div class="col-6">
                <div class="card">
                    <div class="card-body">
                        <h5 class="card-title">Card title</h5>
                        <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
                        <p class="card-text">
                            Some quick example text to build on the card title and make up the bulk of the card's content.
                        </p>
                        <a href="#" class="card-link">Card link</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

https://www.codeply.com/go/dGengaALpm