重写Primeng组件样式的最佳方法是什么? [英] What is Best way to override the style of primeng components?

查看:203
本文介绍了重写Primeng组件样式的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想按组件级别而不是整个应用程序覆盖priming组件的样式,要么我必须更改主theme.css文件中的样式,要么更改内联样式,但是似乎内联有时无法按预期工作,以示例为例我必须使用

i want to overright the style of primeng components as per component level not for whole app, either i have to change the style in main theme.css file or inline style, but seems inline not works sometimes as expected let suppose as example i have to use

<p-dropdown [options]="cities" formControlName="selectedCity"></p-dropdown>

并且我必须根据文档更改类ui-dropdown-item类名称的样式.

and i have to change the style of class ui-dropdown-item class name as per documentation.

我需要具有两个diff样式的相同组件,相同的最佳选择是什么? 如果有工作示例,请添加链接.

i need same component with two diff style what is the best approcah for the same ? if anyone having working example please add the link.

推荐答案

尝试使用

:host >>> .ui-dropdown-item {...}

您将不需要任何包围的div或将样式添加到主style.css.

You won't need any surrounded div or adding the styles to the main style.css.

这篇关于重写Primeng组件样式的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆