2017-08-07 116 views
2

我有材料标签:如何样式选项卡角材料?

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

</div> 
</div> 

我试过的风格每个选项卡,但它不工作:

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

回答

2

默认material'smin-width设置为160px,所以你将不得不重置然后设置你自己的width。以下是默认属性集。

.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; 
} 

所以尝试这样的事情

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

工作示例Plunker

+0

请告诉我是否意味着默认? – Daniel

+0

我需要获取宽度取决于宽度文本里面。 – Daniel

+0

打开'material'文档,并检查'tabs'。您会看到设置了所有属性 –