Published at
Updated at
Reading time
1min
This post is part of my Today I learned series in which I share all my web development learnings.

Today I came across a release post on www.fxsitecompat.dev. The post included that overflow: clip has been unprefixed in Firefox Nightly.

The overflow: clip is similar to overflow: hidden; both values define that overflowing content should not be visible. The difference between those is that clip forces elements not to be scrollable, whereas elements with overflow: hidden are still scroll containers and are still scrollable via JavaScript element.scroll(x, y).

overflow: hidden

This is a long piece of content that overflows the container.

It keeps going and going to make sure there is enough text to scroll through.

Can you scroll down to read this paragraph?

And this one? If you can see this via element.scrollTo(), the container is scrollable.

scrollTop: 0
overflow: hidden hides overflowing content but the element is still a scroll container. JavaScript can scroll it programmatically.
overflow: clip

This is a long piece of content that overflows the container.

It keeps going and going to make sure there is enough text to scroll through.

Can you scroll down to read this paragraph?

And this one? If you can see this via element.scrollTo(), the container is scrollable.

scrollTop: 0
overflow: clip hides overflowing content and prevents the element from being a scroll container entirely. scrollTo() doesn't throw — it just silently does nothing.

This is a wild fun fact! However, I could see this come in handy when there is an exceptional need for custom scroll behavior.

Reimplementing scroll-behavior most likely comes with many accessibility challenges, but hey... maybe there are good examples out there.

If you enjoyed this article...

Join 6.5k readers and learn something new every week with Web Weekly.

Reply to this post and share your thoughts via good old email.
Stefan standing in the park in front of a green background

About Stefan Judis

Frontend nerd with over ten years of experience, freelance dev, "Today I Learned" blogger, conference speaker, and Open Source maintainer.

Related Topics

Related Articles