diff --git a/lib/rdoc/generator/template/darkfish/css/rdoc.css b/lib/rdoc/generator/template/darkfish/css/rdoc.css
index 12212a341e..d525b0ef7d 100644
--- a/lib/rdoc/generator/template/darkfish/css/rdoc.css
+++ b/lib/rdoc/generator/template/darkfish/css/rdoc.css
@@ -85,6 +85,7 @@ h5:target,
 h6:target {
   margin-left: -10px;
   border-left: 10px solid var(--source-code-background-color);
+  scroll-margin-top: 1rem;
 }
 
 /* 4. Links */