如何取消页面中某些元素的样式表规则
我使用 ANTD 框架来构建应用程序。 最近,当我导入 antd-theme.css
时,我注意到 ANTD 元素之一存在一个小问题 由于某些原因,CSS 会覆盖某个 ANTD 元素的规则并使其看起来很糟糕。 我不能拒绝使用这个 css 样式表,因为整个应用程序的其他元素都需要它。 所以它被导入到 index.js
中 另外,我无法覆盖这条破坏 ANTD 元素的规则,因为它的样式表有 24844 行。 我永远不会找到到底是什么打破了它。 相信我,我试过了:(
我很好奇是否有可能使某些元素忽略某些样式表? 喜欢某事
<Radio style={{igonereCss}} />
I using ANTD framework for building an app.
And latelly i noticed one small issue with one of ANTD elements when i import antd-theme.css
For some reasons that css overides rules for one ANTD elements and makes it look terrible.
I cannot refuse from using this css stylesheets because it's needed for other elements all over the app.
So it's imported in index.js
Also i cannot overide this rule which breaks ANTD element, because it's stylesheet has 24844 lines.
And i will never find what exectly breaks it.
Believe me I tried:(
I was curiouse is there some how possible to make some element/elements ignore certain stylesheets?
Like something
<Radio style={{igonereCss}} />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您可以为您的元素提供一个定义的类,它将使用它,而不是其他样式
,然后在您的主要CSS样式表中定义了一种样式。它不必做任何事情,但是它可能会覆盖其他地方发生的样式。
.mystyle {
}
I think you can give your element a class that you define and it will use that over the other styles
Then in your main css style sheet just define a style for that. It doesn't have to do anything, but it might override the styles that are happening elsewhere.
.mystyle {
}
您可以通过覆盖 css 文件中的默认类(您将从开发人员工具获取所有元素类)来更改特定组件的样式,因此
它将全局覆盖样式,仅覆盖特定组件的样式通过给类“test”并覆盖 css 来更新某些 div 中的组件
,它将仅更新特定组件的样式
you can change style of specific component by overriding default class in your css file (you will get all the element classes from developer tool) for that element
as a result it will override the style globally, to override the style for specific component only just wrap the component in some div by giving class "test" and override the css
and it will update the style for specific component only