Same height for nav tabs

I have boot tabs, and some of them have very long text and create an ugly space between the tabs and the content. How can I set other tabs the same size as the largest?

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>
+4
source share
3 answers

Found a solution!

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

.nav-tabs li  a {
    flex: 1;
}
</style>
+8
source

You can make them all higher or you can shorten the tab title too long. The names of the tabs should not really be very long.

0
source

If you cannot use flexbox (which is not supported by older browsers), your only choice is to set all the tabs as tall as possible, with a pixel height. flexbox is a big and, unfortunately, not yet fully used solution to this problem. Without this, there is no flexible way to accomplish this.

0
source

Source: https://habr.com/ru/post/1624024/


All Articles