Full width tabs using Bootstrap (Support IE)

后端 未结 8 1333
孤城傲影
孤城傲影 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: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/

提交回复
热议问题