bootstrap导航头高度

时间:2013-09-24 10:04:16

标签: javascript css twitter-bootstrap tabs nav

如何使标签的所有名称的高度相同? 在LI高度是相同的,但如果我为A高度:100%没有任何变化。 谢谢

simple bootstrap

example

1 个答案:

答案 0 :(得分:6)

您可以使用javascript

$(document).ready(function(){
   var highest = null;

   $(".nav-tabs a").each(function(){  //find the height of your highest link
       var h = $(this).height();
       if(h > highest){
          highest = $(this).height();  
       }    
    });

   $(".nav-tabs a").height(highest);  //set all your links to that height.
});

http://jsfiddle.net/wW2py/9/

对于CSS你可以做

.nav-tabs a {
   height: 62px;  
}

对于您的示例62px有效,但您需要对其进行调整,使其足够大以适应具有最多文本的选项卡。 还要确保在bootstrap css之后应用你的css。

http://jsfiddle.net/p9eFQ/