Skip to main content
Photo of DeepakNess DeepakNess

Better navigation using HTML and CSS

Unproofread notes

Found this fascinating CSS snippet which makes the jump links behavior better.

html {
    scroll-behavior: smooth;
}

[id] {
    scroll-margin-top: 60px;
}

It makes the scrolling smooth and then adds a 60px margin at the top.

Comment via email