如何覆盖angular 2材质样式? [英] How to overwrite angular 2 material styles?
本文介绍了如何覆盖angular 2材质样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在角材料中有这个选择:
I have this select in angular material:
它的代码:
<md-select placeholder="Descuentos y convenios" [(ngModel)]="passenger.discount">
<md-option [value]="null" [disabled]="true">
Descuentos
</md-option>
<md-option *ngFor="let option of discounts" [value]="option">
{{ option }}
</md-option>
<md-option [value]="null" [disabled]="true">
Convenios
</md-option>
<md-option *ngFor="let option of agreements" [value]="option">
{{ option }}
</md-option>
</md-select>
而且我想在其中包含这种样式:
And I would like to have this styles in it:
我试图将一些类放在 md-select 和 md-option 上,但没有奏效.我想提供一个如何放置背景颜色或边框的示例,这会给我一个想法.
I tried to put some classes over md-select and md-option, but not worked. I would like to have maybe just an example of how to put the background color or the border and that would give me an idea.
先谢谢你
推荐答案
我认为类应该有效,但您可能需要使用 /deep/ 因为视图封装.
I think classes should work, but you may need to use /deep/ because of the view encapsulation.
试试这个:
/deep/ md-select.your-class {
background-color: blue;
}
您还可以玩主题.
这篇关于如何覆盖angular 2材质样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文