Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Angular】如何覆盖第三方库css #152

Open
deepthan opened this issue Sep 17, 2021 · 0 comments
Open

【Angular】如何覆盖第三方库css #152

deepthan opened this issue Sep 17, 2021 · 0 comments

Comments

@deepthan
Copy link
Owner

如何更第三方库css

在需要更改的样式前面加上 :host ::ng-deep ,如有个第三方包里有个class为 deepthan的元素,要修改其:

:host ::ng-deep .deepthan{
    color:#000        
}

:host 表示绑定在当前组件上。

若一个元素是一个弹窗怎么覆盖里面的样式

如果这个弹窗时是以body为定位基准的,如 ng-zorro-antd、material、primeng(设置了appendTo=body),则需要在弹窗上加一个class。如

<nz-modal class="my-modal"></nz-modal>
.my-modal ::ng-deep {
    // 要覆盖的样式
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant