Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Same height for nav tabs

I have a bootstrap tabs, and some of them have very long text, and it creates ugly space between tabs and content. How can I set the other tabs to have the same size as the biggest one?

enter image description here

<div class="tabs">
<ul class="nav nav-tabs nav-justified">
    <li>
        <a href="#" class="text-center">
            <i class="fa fa-wifi"/> Not that long</a>
    </li>
    <li>
        <a href="#" class="text-center">
            <i class="fa fa-map-marker"/> Something really really really long</a>
    </li>
    <li>
        <a href="#" class="text-center">
            <i class="fa fa-map-marker"/> Not that long</a>
    </li>
    <li class="active">
        <a href="#" class="text-center">
            <i class="fa fa-star"/> Not that long</a>
    </li>
</ul>
<div class="tab-content"></div>
</div>
like image 831
zdarsky.peter Avatar asked Jan 13 '16 00:01

zdarsky.peter


People also ask

How will you create a tabbed pills and vertical pills navigation menu in bootstrap?

To make the tabs toggleable, add the data-toggle="tab" attribute to each link. Then add a . tab-pane class with a unique ID for every tab and wrap them inside a <div> element with class . tab-content .

How do I create a navigation tab in bootstrap?

Approach: To create a tabbed navigation menu, create a basic unordered list with list items as links. Then add classes nav and nav-tabs of bootstrap to unordered list and nav-items class to list items.

What is bootstrap tab content?

Tabs are used to separate content into different panes where each pane is viewable one at a time. For a tutorial about Tabs, read our Bootstrap Tabs/Pills Tutorial.

What is bootstrap role presentation?

role=presentation on <li> is ONLY needed if there is a role on <ul> too e.g. <ul role="tablist"> . It's because <li> belongs to <ul> but not to <ul role="tablist"> . Such element is not <ul> anymore. It's same as <div role="tablist"> now - its semantics has changed by assigning a role .


1 Answers

Found a solution!

<style>
.nav-tabs{
    display: flex;
}
.nav-tabs li {
    display: flex;
    flex: 1;
}

.nav-tabs li  a {
    flex: 1;
}
</style>
like image 138
zdarsky.peter Avatar answered Sep 22 '22 13:09

zdarsky.peter