diff --git a/doc/api_assets/style.css b/doc/api_assets/style.css
index 663025e1c27ef5..acab9bfa04858e 100644
--- a/doc/api_assets/style.css
+++ b/doc/api_assets/style.css
@@ -40,17 +40,13 @@
   --color-text-secondary: var(--green2);
 }
 
+h2 :target,
+h3 :target,
 h4 :target,
 h5 :target {
   scroll-margin-top: 55px;
 }
 
-@supports not (content-visibility: auto) {
-  h3 :target {
-    scroll-margin-top: 55px;
-  }
-}
-
 .dark-mode {
   --background-color-highlight: var(--black2);
   --color-critical: var(--red4);