Bootstrap fixed navbar inside div

后端 未结 2 1018
清酒与你
清酒与你 2021-01-12 05:28

In bootstrap documentation they\'re able to \"trap\" a .navbar-fixed-top inside their .bs-docs-example div:

相关标签:
2条回答
  • 2021-01-12 05:58
    <div class="container-fluid">
        <div class="container">
            <nav class="navbar">...</nav>
        </div>
    </div>
    

    That works with built-in Bootstrap's CSS.

    0 讨论(0)
  • 2021-01-12 06:09

    Ok figured it out. The parent element container must have position: relative, and navbar must have position: absolute, that way if you attach either .navbar-fixed-top or .navbar-fixed-bottom it will get fixed relative to the parent element and NOT relative to the entire page. Yeah!

    0 讨论(0)
提交回复
热议问题