在我的导航中添加标题

时间:2018-03-02 15:33:08

标签: html css navigation bootstrap-4

我正在尝试添加标题作为导航的一部分,但在它下面是这样的: enter image description here

我尝试使用bootstrap添加另一行,但它只是出现如下:

enter image description here

这是我的代码:

sleep_for()

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

详细了解Bootstrap的Navbargrid

  • navbar 应包含supported content
  • 标题不应位于navbar中,请将其放在下面。
  • .container不应嵌套在其他.container s。
  • .row仅包含 col-*

Demo on Codeply

<div class="container">
    <nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top" id="mainNav">
        <a class="navbar-brand js-scroll-trigger" href="#page-top">Bunk.</a>
        <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
            Menu
            <i class="fa fa-bars"></i>
        </button>
        <div class="collapse navbar-collapse" id="navbarResponsive">
            <ul class="navbar-nav ml-auto">
                <li class="nav-item">
                    <a class="nav-link js-scroll-trigger" href="#tenant">TENANT</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link js-scroll-trigger" href="#landlord">LANDLORD</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link js-scroll-trigger" href="#bunkfaqs">BUNK FAQs</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link js-scroll-trigger" href="#blog">BLOG</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link js-scroll-trigger" href="#team">TEAM</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link js-scroll-trigger" href="#login">LOG IN</a>
                </li>
            </ul>
        </div>
    </nav>
</div>
<div class="container-fluid bg-light">
    <header id="header" class="d-flex align-items-center">
        <h2 class="mx-auto">Tenants</h2>
    </header>
</div>