Override primeng css classes in Angular

蓝咒 提交于 2019-12-07 21:50:30

问题


The thing is that I want to override the CSS classes of primeng and change some colors. No matter how I do it it doesn't change. If change the ViewEncapsulation to none the component doesn't even appear. I've tried something like this:

.ui-chkbox-box.ui-state-active, .ui-radiobutton-box.ui-state-active {
 border: 1px solid red !important;
  background: red !important;
  color: #FFFFFF;
}

Trying to override the properties in the component css but it still doesn't work.

I know other people have asked the same question but none of the answers has helped me so I'm a little bit desperate.


回答1:


Add ::ng-deep

::ng-deep .ui-chkbox-box.ui-state-active{...}



回答2:


I added the classes to the app.less file and it worked like a charm. The component .css was not working.



来源:https://stackoverflow.com/questions/46280708/override-primeng-css-classes-in-angular

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!