3

I am using angular-bootstrap tabs as,

<tabset>
  <tab  ng-repeat="tab in tabs" ui-sref="{{tab.state}}">
    <tab-heading  class="navbar-header" style="cursor:pointer;">
        <div class="col-md-1" style="width: 130px;">
          {{tab.title}}
        </div>
    </tab-heading>
  </tab>
</tabset>
<div class="row-fluid"><div class="ui-view-content" ui-view></div></div>

I am facing problems with the highlighted white color for active tab. The white color is drawn over smaller height when the tab title is short and longer heights when the tab title is long

enter image description here enter image description here

Angular version is "1.4.1" and angular bootstrap version is "0.12.2"

App css:

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
    color: #555555;
    cursor: default;
    background-color:        #ffffff;
    border: 1px solid #dddddd;
    border-bottom-color: transparent;
}

How to ensure that the selected tab heading's white color is of uniform height?

Fizzix
  • 23,679
  • 38
  • 110
  • 176

3 Answers3

2

Have you tried using white-space: nowrap? It basically forces the text to not wrap to the next line. Very easy to use. Here is an example.

CSS:

.nav-tabs li, .nav-tabs a {
    white-space:nowrap;
    overflow: hidden;
}

Working Example

If the above doesn't work, for whatever reason, try setting a max-height.

Fizzix
  • 23,679
  • 38
  • 110
  • 176
0

I believe you cannot achieve this in css. You will have to use javascript to find the tab with max height and apply that height to the rest of them.

Something from this post would help in the script - jQuery Equal Height Divs

Community
  • 1
  • 1
Chetan
  • 945
  • 1
  • 5
  • 14
0

With Boostrap 5:

.nav-tabs {
  align-items: stretch;
}

.nav-tabs .nav-link {
  height: 102%;
}

The height may vary on more complex setups.

madbob
  • 456
  • 1
  • 6
  • 13