简体   繁体   中英

Center navbar tabs for full size screens and within navbar-collapse for mobile screens

I've got a navbar with several tabs on it. When the screen size becomes small enough these tabs disappear and collect in the form of a clickable button, navbar-collapse , which expands showing the tabs in a vertical manner. I was able to have the elements in the dropdown centered with text-align: center , but this does not seem to affect the tabs when the navbar is fullsize. Is there a way to center the tabs both on fullsize and mobile (on the dropdown) which I was already able to do. Here's the JSFiddle: http://jsfiddle.net/sushiknives/c1zjbrmj/

One note on the JSFiddle: you need to drag the result page far left to see what the page would look like full-size.

One way is to use nav-justified ...

<ul class="nav nav-justified">
        <li><a href="#">Home</a></li>
        <li><a href="#">Condominii</a></li>
        <li><a href="#">Chi Siamo</a></li>
        <li><a href="#">Fornitori</a></li>
        <li><a href="#">Contatti</a></li>
        <li><a href="#">Dove Siamo</a></li>
</ul>

Demo: http://codeply.com/go/MSEeod5De9

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM