gpt4 book ai didi

css - 完全重置@media 屏幕内的 css 类

转载 作者:太空宇宙 更新时间:2023-11-03 21:29:28 25 4
gpt4 key购买 nike

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

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

时是否有一种简单的方法来重置 CSS 中的类

最佳答案

有一个名为 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

关于css - 完全重置@media 屏幕内的 css 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30495793/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com