Full width tabs using Bootstrap (Support IE)

后端 未结 8 1302
孤城傲影
孤城傲影 2021-02-02 07:34

I\'m trying to adjust Bootstrap tabs to make them span the full width of their container. Here\'s my code (a minimal working example):


<         


        
相关标签:
8条回答
  • 2021-02-02 08:34

    Simple:

    .nav-tabs > li {
        /* width = (100 / number of tabs). This example assumes 3 tabs. */
        width:33.33333%;
    }
    

    Hope that helps!

    0 讨论(0)
  • 2021-02-02 08:35

    Try this, for all '.nav-pills' and each 'li' element inside with double loop.

    function(){
    $('.nav.nav-tabs').each(function(){
        var liGroup = $(this).children('li');
        var liLength= liGroup.length;
        liGroup.each(function(){
            var liWidth = 100/liLength-1;
            $(this).css({'min-width': liWidth+'%','margin-left':'0px','margin-right':'0px'});
        });
    });}
    

    DEMO http://jsfiddle.net/

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