我有一个简单的导航栏,但是它拒绝使用uill 12 col宽度。

         <!--Mobile NAV BAR ROW-->
    <div class="row row-nomargin">
        <div class="col-md-8 col-md-offset-2">
          <nav class="navbar navbar-default navbar-left">
                <!-- 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="#bs-example-navbar-collapse-1">
                    <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="bs-example-navbar-collapse-1">
                  <ul class="nav navbar-nav navbar-right">
                    <li class="active"><a href="/home.html">Home</a></li>
                    <li><a href="/gallery.html">Gallery</a></li>
                    <li><a href="/pricing.html">Pricing</a></li>
                    <li><a href="/aboutus.html">About us</a></li>
                    <li><a href="/contactus.html">Contact us</a></li>
                    </a></li>
                  </ul>
                </div><!-- /.navbar-collapse -->
            </nav>
        </div>
    </div>


它的priob是我在css中覆盖的东西(我不应该这样做),但是我看不到

   .navbar .nav > li > a {
    color:  white;
    }
   .navbar-default {
        /*Overwrites bootstrap css*/
        box-shadow:
        border: 0;
       margin-bottom:0;
        /*background-image: url('../img/navbarbackground1.png');*/
       font-family: 'Cooper Black';
       background-color: rgb(1,165,228);
       /*background-color: rgba(0,0,0,0.0);*/
       /*border: 2px dashed #FFFFFF;box-shadow: 0 0 0 0px #A0785A, 2px 0px 20px 0px;*/
    }

    .navbar-fixed-bottom {
        /*Overwrites bootstrap css*/
        background-image: url("../img/backgroundImage.jpg");
    }

    .nav-tabs{
        /*MFOHARE Specific css*/
        right: 0px;
        color: white;
    }


.row-nomargin{
    margin: 0px;
}


任何想法都在这里-我的导航栏只有它上的链接一样宽。

最佳答案

您在navbar-left元素上具有类navnavbar-left做一件事:

.navbar-left {
  float: left !important;
}


因此,整个nav将向左浮动并缩小以适合其中的项目。您可能只需删除该类,它将解决您的问题。

09-25 14:58