如何解决如何禁用CSS样式?
我目前正在我的React App中使用antd
软件包,包括CSS软件包。但是,我想禁用一条规则:
body,html {
width: 100%;
height: 100%;
}
如何在不导入CSS的情况下禁用/删除此规则?
解决方法
您可以覆盖在CSS包之后导入个人CSS的规则
,如果由于某种原因无法访问该CSS,则可以添加自己的CSS;
body,html {
width: inherit;
height: inherit;
}
示例:
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>
您可以在此处详细了解inherit
属性;
https://www.w3schools.com/cssref/css_inherit.asp
https://developer.mozilla.org/en-US/docs/Web/CSS/inherit
,将规则覆盖到您的styles.css(或您正在全局使用的任何样式文件)中
body,html {
width: initial !important;
height: initial !important;
}
,
您尝试过吗?
body,html {
// width: 100%;
// height: 100%;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。