简体   繁体   English

如何禁用 CSS 样式?

[英]How to disable a CSS style?

I'm currently using the antd package with my React App including the CSS package. However, I'd like to disable a rule:我目前正在将antd package 与我的 React 应用程序一起使用,包括 CSS package。但是,我想禁用一条规则:

body, html {
        width: 100%;
        height: 100%;
}

How would I disable/remove this rule without not importing the CSS?如果不导入 CSS,我将如何禁用/删除此规则?

You can overwrite that rule importing your personal CSS after package CSS您可以覆盖该规则,在 CSS 之后导入您的个人 CSS CSS

If you cannot access that CSS for whatever reason, you can add your own CSS like so;如果您出于某种原因无法访问该 CSS,您可以像这样添加自己的 CSS;

body, html {
    width: inherit;
    height: inherit;
}

Example:例子:

 body { background-color: blue; } body { background-color: inherit; }
 <div> The body background colour should be BLUE as per CSS, but because of the following INHERIT attribute, it is now back to default white. </div>

You can read more about the inherit attribute here;您可以在此处阅读有关inherit属性的更多信息;

https://www.w3schools.com/cssref/css_inherit.asp https://www.w3schools.com/cssref/css_inherit.asp

https://developer.mozilla.org/en-US/docs/Web/CSS/inherit https://developer.mozilla.org/en-US/docs/Web/CSS/inherit

I'm currently using the antd package with my React App including the CSS package.我目前正在使用antd package 和我的 React 应用程序,包括 CSS package。 However, I'd like to disable a rule:但是,我想禁用一条规则:

body, html {
        width: 100%;
        height: 100%;
}

How would I disable/remove this rule without not importing the CSS?如何在不导入 CSS 的情况下禁用/删除此规则?

Have you tried this?你试过这个吗?

body, html {
      //  width: 100%;
      //  height: 100%;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM