如何覆盖 Angular8 .pug 文件中的样式?
How to override style in Angular8 .pug file?
我创建了 'modal component'。
此模式调用 .pug 文件中的 'another component'。
所以从技术上讲,我正在使用来自 'another component'.
的 'modal component' 的样式和内容
但我想覆盖 'modal component' 中的样式。
我该怎么做?它默认采用 'another component'.
中的样式
我不能只更改 'another component' 中的样式,因为它在应用程序的几个地方使用。
我认为这只是 CSS 特异性的问题,如果我没听错的话。
如果您要将 class 添加到调用其他组件的模态组件中的父元素,您可以利用特异性
.modal { blah } // 这将是被调用的组件 styles
.my-modal .modal { overwriting styles } // 这将在您的模态样式中
或者,如果您要在调用模式的父容器上使用 ngClass,您将向父容器添加一些内联样式,这也将优先于样式表中的 css
我创建了 'modal component'。 此模式调用 .pug 文件中的 'another component'。 所以从技术上讲,我正在使用来自 'another component'.
的 'modal component' 的样式和内容但我想覆盖 'modal component' 中的样式。
我该怎么做?它默认采用 'another component'.
中的样式我不能只更改 'another component' 中的样式,因为它在应用程序的几个地方使用。
我认为这只是 CSS 特异性的问题,如果我没听错的话。
如果您要将 class 添加到调用其他组件的模态组件中的父元素,您可以利用特异性
.modal { blah } // 这将是被调用的组件 styles
.my-modal .modal { overwriting styles } // 这将在您的模态样式中
或者,如果您要在调用模式的父容器上使用 ngClass,您将向父容器添加一些内联样式,这也将优先于样式表中的 css