Daniel
Daniel

Reputation: 1755

How to style tabs Angular Material?

I have Material Tabs:

<div id="tabs">
  <md-tab-group [selectedIndex]="0">
    <md-tab label="Sd">
      kkk
    </md-tab>

</div>
</div>

I tried to style each tab, but it does not work:

#tabs .mat-tab-label {
  width: 167px;
  height: 42px;
  border-radius: 3px;
  background-color: #e0e0e0;
}

Upvotes: 2

Views: 11482

Answers (1)

Bhavik Patel
Bhavik Patel

Reputation: 1074

By default material's min-width is set to 160px, so you will have to reset that and then set your own width. Below is the default property set.

.mat-tab-label[_ngcontent-c19] {
    line-height: 48px;
    height: 48px;
    padding: 0 12px;
    cursor: pointer;
    box-sizing: border-box;
    opacity: .6;
    min-width: 160px;
    text-align: center;
    position: relative;
}

So try something like this

#tabs .mat-tab-label {
 min-width : 0px; // added
  width: 167px;
  height: 42px;
  border-radius: 3px;
  background-color: #e0e0e0;
}

Working example : Plunker

Upvotes: 2

Related Questions