完全重置@media 屏幕内的 css class

Completely reset a css class inside @media screen

我有一个主站点的菜单栏,其中有很多 CSS,但对于智能手机用户,我想完全重新设计菜单栏。我通过使用 @media only screen and (max-width: 767px) {} 并更改那里的 classes 的属性来做到这一点,但是一切都是从原始 class 继承的,并且重置每个 [=23] 真的很痛苦=] 在每个 class 手动。

所以我想知道在使用 @media only screen and (max-width: 767px) {}

时是否有一种简单的方法可以在 CSS 中重置 class

有一个名为 all 的 属性 用于重置所有 CSS 属性。

.classname {
    all: initial; /* or unset */
}

initial - This keyword indicates to change all the properties applying to the element or the element's parent to their initial value...

unset - This keyword indicates to change all the properties applying to the element or the element's parent to their parent value if they are inheritable or to their initial value if not...

浏览器支持:Chrome 37+、Firefox 27+、IE 11+、Safari 不支持

阅读更多:https://developer.mozilla.org/en-US/docs/Web/CSS/all