Bootstrap navbar justify / span menu items occupying full width

前端 未结 6 1342
粉色の甜心
粉色の甜心 2020-12-08 00:38

I use the default Twitter Bootstrap responsive navbar (without the logo and search), but I want the menu items to be spanned, occupying the full width of the menu bar.

6条回答
  •  再見小時候
    2020-12-08 01:21

    Have a look at Bootstrap's official example:

    /* Customize the navbar links to be fill the entire space of the .navbar */
    .navbar .navbar-inner {
        padding: 0;
    }
    
    .navbar .nav {
        margin: 0;
        display: table;
        width: 100%;
    }
    
    .navbar .nav li {
        display: table-cell;
        width: 1%;
        float: none;
    }
    
    .navbar .nav li a {
        font-weight: bold;
        text-align: center;
        border-left: 1px solid rgba(255, 255, 255, .75);
        border-right: 1px solid rgba(0, 0, 0, .1);
    }
    
    .navbar .nav li:first-child a {
        border-left: 0;
        border-radius: 3px 0 0 3px;
    }
    
    .navbar .nav li:last-child a {
        border-right: 0;
        border-radius: 0 3px 3px 0;
    }
    

提交回复
热议问题