角2材质的垫舌尺寸 [英] Angular 2 material mat-tab size
本文介绍了角2材质的垫舌尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码
<mat-tab-group>
<div *ngFor="let question of subcategory.questions">
<mat-tab label={{question.question_id}} class="question-tab">{{question.question}}</mat-tab>
</div>
</mat-tab-group>
显示如下:
但是我想减小制表符宽度,如下所示:
However I want to reduce tabs width, like this:
问题是,当我在运行时更改css时,它调整得很好,但是当我将css像这样时:
The problem is, when I change css at run time, it adjusts fine, but when I put css like:
.mat-tab {
min-width: 50px !important;
}
.mat-tab-label[_ngcontent-c9]{
min-width: 50px !important;
}
它不起作用.知道如何解决这个问题吗?
It doesn't work. Any idea how to approach this ?
推荐答案
尝试一下:
/deep/.mat-tab-label, /deep/.mat-tab-label-active{
min-width: 0!important;
padding: 3px!important;
margin: 3px!important;
}
注意::在角度8 /deep/
中不起作用...可以使用::ng-deep
,如下所示:
NOTE: In angular 8 /deep/
not working... you can use ::ng-deep
, like so:
::ng-deep.mat-tab-label, ::ng-deep.mat-tab-label-active{
min-width: 0!important;
padding: 3px!important;
margin: 3px!important;
}
这篇关于角2材质的垫舌尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文