Skip to content

Add spacing at the top to the height of the pinned navigation? #22

@krystian3w

Description

@krystian3w

I noticed that your HTML anchors may be obscured (e.g., we can not see the headline/heading and part of the link to a given installer or archive package).

Some time ago, the following was added to CSS:

https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/scroll-margin-top
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/scroll-padding-top

For legacy can be used :target:

body :target {
	padding-top: 56px
}

@supports (scroll-margin-top: 0) {
	body :target {
		padding-top: unset;
		scroll-margin-top: 56px
	}
}

Unfortunately, I don't know if it's possible to detect that someone has a larger header in CSS itself, but off the top of my head, you could add a negation in the media for high contrast (assuming that someone will probably increase the font size then):

https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/prefers-reduced-motion
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/prefers-contrast
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/forced-colors

@media 
  (prefers-reduced-motion: no-preference) and
  (prefers-contrast: no-preference) and
  (forced-colors: none) {
	body :target {
		padding-top: 56px
	}

	@supports (scroll-margin-top: 0) {
		body :target {
			padding-top: unset;
			scroll-margin-top: 56px
		}
	}
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions