gpt4 book ai didi

css - 如何使用 [ngStyle] 覆盖 ionic 自定义 CSS

转载 作者:太空宇宙 更新时间:2023-11-04 05:44:10 24 4
gpt4 key购买 nike

如何使用 [ngStyle] 覆盖 ionic 自定义 CSS

我试过下面的代码,但它不工作:

[ngStyle]="{'--color': 'blue'}"

最佳答案

您可以使用“!important”来覆盖 ionic 自定义 CSS。

但是,这是一种不好的做法,它不适用于 [ngStyle]

您可以像这样使用它,而不是在 [ngStyle] 中使用 !important :

[attr.style]="'--color:blue !important'"

关于css - 如何使用 [ngStyle] 覆盖 ionic 自定义 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58875084/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com