How do I center the twitter bootstrap tabs on the page?

前端 未结 8 1938
我寻月下人不归
我寻月下人不归 2020-12-04 07:19

I\'m using twitter bootstrap to create togglable tabs. Here is the css I\'m using:

    &
相关标签:
8条回答
  • 2020-12-04 08:19

    Adding the class nav-justified works for me. This not only center aligns the tabs but it also spreads them nicely at the top.

    <ul class="nav nav-tabs nav-justified">
        <li><a href="#Page1">Page1</a></li>
        <li><a href="#Page2">Page2</a></li>
        <li><a href="#Page3">Page3</a></li>
        <li><a href="#Page4">Page4</a></li>
      </ul>
    

    Even though the accepted answer works well, I found the above more natural to Bootstrap.

    0 讨论(0)
  • 2020-12-04 08:20

    if you use bs4 simply you can add justify-content-center class to your nav-tabs to center it on page. if you want your tabs to be justified (full-with) add nav-justified class to it, in this case if you have 3 items in your nav each of them has 33% with. if 5 items is there each one have 20% with.

    another way is simply to add text-center if you are use bs3 .

    0 讨论(0)
提交回复
热议问题