Center the nav in Twitter Bootstrap

前端 未结 8 2068
隐瞒了意图╮
隐瞒了意图╮ 2020-12-07 16:00

I want to be able to center the nav dead middle of a page and have it stayed centered in different resolutions. I don\'t want to use offsets to push it over or margin-left a

相关标签:
8条回答
  • 2020-12-07 16:36

    For Bootstrap v4 check this:

    https://v4-alpha.getbootstrap.com/components/pagination/#alignment

    only add class to ul.pagination:

    <nav">
      <ul class="pagination justify-content-center">
        <li class="page-item disabled">
          <a class="page-link" href="#" tabindex="-1">Previous</a>
        </li>
        <li class="page-item"><a class="page-link" href="#">1</a></li>
        <li class="page-item"><a class="page-link" href="#">2</a></li>
        <li class="page-item"><a class="page-link" href="#">3</a></li>
        <li class="page-item">
          <a class="page-link" href="#">Next</a>
        </li>
      </ul>
    </nav>
    
    0 讨论(0)
  • 2020-12-07 16:37

    Code used basic nav bootstrap

    <!--MENU CENTER`enter code here` RESPONSIVE -->
    
      <div class="container-fluid">
            <div class="container logo"><h1>LOGO</h1></div>
          <nav class="navbar navbar-default menu">
            <div class="container-fluid">
              <!-- Brand and toggle get grouped for better mobile display -->
              <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#defaultNavbar2"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
               </div>
              <!-- Collect the nav links, forms, and other content for toggling -->
              <div class="collapse navbar-collapse" id="defaultNavbar2">
                <ul class="nav nav-justified" >
                  <li><a href="#">Home</a></li>
                  <li><a href="#">Link</a></li>
                  <li><a href="#">Link</a></li>
                  <li><a href="#">Link</a></li>
                  <li><a href="#">Link</a></li>
                  <li><a href="#">Link</a></li>
                  <li><a href="#">Link</a></li>
                </ul>
              </div>
              <!-- /.navbar-collapse -->
            </div>
            <!-- /.container-fluid -->
          </nav>
        </div>
      <!-- END MENU-->

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