空间li元素均匀地在boostrap col

时间:2016-08-02 14:27:32

标签: html css twitter-bootstrap

我已经制作了我的nav ul width col-lg-10并且我希望所有li元素在此范围内均匀分布,这可能吗?目前,li元素似乎不适合整个col-lg-8宽度,它们只是位于div的中间。

<!-- MENU -->
            <div class="row">
                <nav class="navbar navbar-default" role="navigation">
                    <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="#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 col-lg-8">
                               <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Who Are We</a>
<MSL:Navigation ShowSectionNav="true"  SectionPageName="/whoarewe/" ContainerCssClass="dropdown-menu"/>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">What's On</a>
<MSL:Navigation ShowSectionNav="true"  SectionPageName="/whats-on/" ContainerCssClass="dropdown-menu"/>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Your Voice</a>
                                    <MSL:Navigation ShowSectionNav="true"  SectionPageName="/your-voice/" ContainerCssClass="dropdown-menu"/>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Advice &amp; Support</a>
<MSL:Navigation ShowSectionNav="true"  SectionPageName="/advice/" ContainerCssClass="dropdown-menu"/>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Activities</a>
<MSL:Navigation ShowSectionNav="true"  SectionPageName="/activities/" ContainerCssClass="dropdown-menu"/>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Jobs &amp; Volunteering</a>
<MSL:Navigation ShowSectionNav="true"  SectionPageName="/jobs/" ContainerCssClass="dropdown-menu"/>
                                </li>

                                <li class="dropdown">
                                    <a href="/coopers/bar">Coopers Bar</a>
                                </li>

                                <li class="dropdown">
                                    <a href="/studenthub">Student Hub</a>
                                </li>

                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Contact Us</a>
<MSL:Navigation ShowSectionNav="true"  SectionPageName="/contact/" ContainerCssClass="dropdown-menu"/>
                                </li>
                            </ul>

                        </div><!-- /.navbar-collapse -->
                    </div><!-- /.container-fluid -->
                </nav>
            </div>

CSS

    //out:null

    .navbar-default {
        background: #5f336d;
    }

    .navbar {

        margin: 0px;
        border-radius: 0px !important;

        .navbar-collapse {



@media (min-width: @grid-float-breakpoint) {
            text-align: center;
        }

        .nav, .nav > li {
            @media (min-width: @grid-float-breakpoint) {
                float:none;
                display:inline-block;
                *display:inline; /* ie7 fix */
                *zoom:1; /* hasLayout ie7 trigger */
                vertical-align: top;
            }
        }


    }

    a {
        font-weight: 600;
        font-size: @font-size-base;
        color: #fff !important;
    }


    .dropdown:hover, .dropdown.open {
        position:relative;

        &:after {
            content: '';
            position:absolute;
            top:0;
            left:0;
            height:3px;
            background-color: @brand-primary;
            width:100%;
            z-index:99999;
        }
    }

    .dropdown.open > .dropdown-menu > ul {
        list-style: none;
        padding: 0 0 0 18px;
    }

    .dropdown-menu {
        min-width:190px;
    }

}

0 个答案:

没有答案