content/static: pad unit page anchor link targets
Adds spacing above anchor link targets on the details page to
account for sticky header.
Change-Id: Iaf1c5e1189a3cae92475ddeab1fb3fe6b9ea6e7f
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259200
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
diff --git a/content/static/css/unit_details.css b/content/static/css/unit_details.css
index 97c9da8..576a0b9 100644
--- a/content/static/css/unit_details.css
+++ b/content/static/css/unit_details.css
@@ -71,3 +71,21 @@
display: block;
}
}
+.UnitDetails-content :target::before {
+ content: '';
+ display: block;
+ position: relative;
+ width: 0;
+ height: calc(var(--header-height) + 3.75rem);
+ margin-top: calc(
+ -1 * (var(--header-height) + 3.75rem)
+ ); /* Move hidden anchor content for deep linking with a sticky header. */
+}
+@media only screen and (min-width: 52rem) {
+ .UnitDetails-content :target::before {
+ height: calc(var(--header-height) + 0.75rem);
+ margin-top: calc(
+ -1 * (var(--header-height) + 0.75rem)
+ ); /* Move hidden anchor content for deep linking with a sticky header. */
+ }
+}