Hacker News new | ask | show | jobs
by dredmorbius 506 days ago
Fixed isn't the industry standard way of making sticky headers in 2025

What is? Flexbox? Or something else?

(Not a FE dev, though I'm vaguely conversant in CSS, mostly by using it to fix site annoyances on my own via stylesheet management extensions such as Stylus.)

1 comments

There's `position: sticky` now for headers. It has better ergonomics than fixed and it's nice than it's supported by all modern browsers.

https://developer.mozilla.org/en-US/docs/Web/CSS/position

It's a huge improvement for sticky sidebars that are only scroll within their parent element. For example, it's what I use on this page: https://allaboutberlin.com/guides/public-transit
Thanks!