为什么设置 h1 all: intial 使它成为 19px

why does setting h1 all: intial makes it 19px

我想让我网站的一部分以默认样式显示 html,基本上忽略所有其他 css 文件,仅针对某些元素。

所以我尝试了所有: initial !important;它给了我想要的输出,但是当使用 h1 标签时,输出文本的字体大小为 19px,应该是 32px,是我做错了什么还是浏览器错误?

编辑:使用还原时我得到磨损效果参见:https://imgur.com/a/pEmJFpw 有关更多解释,请参阅我在 post

下方的评论

你需要考虑使用revert

The revert CSS keyword reverts the cascaded value of the property from its current value to the value the property would have had if no changes had been made by the current style origin to the current element. Thus, it resets the property to its inherited value if it inherits from its parent or to the default value established by the user agent's stylesheet ref

initial 不会很好,因为它做了一些不同的事情

The initial CSS keyword applies the initial (or default) value of a property to an element. It can be applied to any CSS property. This includes the CSS shorthand all, with which initial can be used to restore all CSS properties to their initial state.

注意一个属性。所以initial不会考虑浏览器默认的CSS.

相关: