Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
覆盖角垫选项卡的css_Css_Angular_Angular Material - Fatal编程技术网

覆盖角垫选项卡的css

覆盖角垫选项卡的css,css,angular,angular-material,Css,Angular,Angular Material,我想更改垫子标签的垫子标签颜色。我添加的css是: .mat-tab-label { min-width: 25px !important; padding: 5px; background-color: transparent; color: white; opacity: 1 !important; font-weight: 700; } 它正在更改选项卡的颜色。但是,它正在改变整个应用程序中所有mat选项卡的颜色。如何单独更改特定选项卡。您可以使用组件标签 ap

我想更改垫子标签的垫子标签颜色。我添加的css是:

.mat-tab-label {
  min-width: 25px !important;
  padding: 5px;
  background-color: transparent;
  color: white;
  opacity: 1 !important;
  font-weight: 700;
}

它正在更改选项卡的颜色。但是,它正在改变整个应用程序中所有mat选项卡的颜色。如何单独更改特定选项卡。

您可以使用组件标签

 app-component-name .mat-tab-label {
    min-width: 25px !important;
    padding: 5px;
    background-color: transparent;
    color: white;
    opacity: 1 !important;
    font-weight: 700;
}

或者将类添加到选项卡

您必须在style.css或style.scss中重写类样式

.mat-tab-label {
  min-width: 25px !important;
  padding: 10px;
  background-color: transparent;
  color: white;
  opacity: 1 !important;
  font-weight: 700;
}

Stackblitz:

如果您在global style.css或scss中设置选项卡的样式,则所有选项卡的样式都将更改。您需要在要使用该样式的组件中添加一个用于隔离的文件。@anthonywillismuñoz您是对的。我在单个组件中添加了css。但是,它反映了allTry添加到style.css中,它将起作用@MaruthiErankiI移动到style.css,并将组件作为前缀添加到.mat选项卡标签。这解决了问题。