How to stretch elements of a Bootstrap navigation bar to make use of the entire width?

后端 未结 2 1242
醉话见心
醉话见心 2020-12-28 17:47

Consider the following Bootstrap navigation bar:

\"My

Some facts abou

2条回答
  •  轮回少年
    2020-12-28 17:53

    You could use CSS Table display layout to distribute your nav items. Its well supported across browsers and simple to implement:

    .navbar-nav {
        display:table;
        width:100%;
        margin: 0;
    }
    .navbar-nav > li {
        float:none;
        display:table-cell;
        text-align:center;
    }
    

    This makes it 100% the width of its parent #header, which in turn is restricted by the width of #page, so if you need it to span 100% of the whole document width you'll need to move it out of #page or make #page wider.

    http://jsfiddle.net/zBM6D/5/

提交回复
热议问题