
User-Agent Stylesheet
In May 2025 all browsers should have removed the default styling for the h1 element when it is nested in a sectioning element (article, aside, nav, section). I went into Firefox Dev Editions user-agent style sheet and noticed that the styling for nested h1 elements is still the same. I'm wondering why that is the case, since I was under the impression that all the major browsers had completed make the necessary adjustments at the end of May 2025.
被選擇的解決方法
Hi Paul, the MDN article says this was rolled out to all users in Firefox 140:
https://developer.mozilla.org/docs/Web/HTML/Reference/Elements/Heading_Elements => Browser Compatibility section
During the rollout, the change was controlled by a temporary preference. Can you check your about:config to confirm:
layout.css.h1-in-section-ua-styles.enabled => false
If you check the source of Firefox 140 and Firefox 141 beta, you'll notice the nesting is gated by the value of that preference at:
- https://searchfox.org/mozilla-release/source/layout/style/res/html.css#229
- https://searchfox.org/mozilla-beta/source/layout/style/res/html.css#237
A change has already been checked in to Nightly to delete the temporary preference and that rules section in Firefox 142: https://bugzilla.mozilla.org/show_bug.cgi?id=1976196
Since you are acquainted with this change, if you notice any problems with the implementation, please file a new bug.
從原來的回覆中察看解決方案 👍 0所有回覆 (2)
選擇的解決方法
Hi Paul, the MDN article says this was rolled out to all users in Firefox 140:
https://developer.mozilla.org/docs/Web/HTML/Reference/Elements/Heading_Elements => Browser Compatibility section
During the rollout, the change was controlled by a temporary preference. Can you check your about:config to confirm:
layout.css.h1-in-section-ua-styles.enabled => false
If you check the source of Firefox 140 and Firefox 141 beta, you'll notice the nesting is gated by the value of that preference at:
- https://searchfox.org/mozilla-release/source/layout/style/res/html.css#229
- https://searchfox.org/mozilla-beta/source/layout/style/res/html.css#237
A change has already been checked in to Nightly to delete the temporary preference and that rules section in Firefox 142: https://bugzilla.mozilla.org/show_bug.cgi?id=1976196
Since you are acquainted with this change, if you notice any problems with the implementation, please file a new bug.
Thanks for the quick response.
I checked the setting and you are right it is turned off.