Day 47: the overscroll-behavior property

posted on

It’s time to get me up to speed with modern CSS. There’s so much new in CSS that I know too little about. To change that I’ve started #100DaysOfMoreOrLessModernCSS. Why more or less modern CSS? Because some topics will be about cutting-edge features, while other stuff has been around for quite a while already, but I just have little to no experience with it.


You can use the overscroll-behavior property to disable scroll-chaining.

If you scroll the inner box in the following example to the end and you keep scrolling, the outer box starts scrolling, too, and finally the whole page.

And suckers be thinkin' that they can fake this
But I'ma drop it at a higher level
'Cause I'm inclined to stoop down, hand out some beatdowns
Could run a train on punk fools that think they run the game
But I learned to burn that bridge and delete
Those who compete at a level that's obsolete
Instead, I warm my hands upon the flames of the flag
To recall the downfall and the businesses that burnt us all
See through the news and the views that twist reality
Enough, I call the bluff, fuck Manifest Destiny
Landlords and power whores, on my people, they took turns
Dispute the suits, I ignite and then watch 'em burn

With the thoughts from a militant mind
Hardline, hardline after hardline
Landlords and power whores, on my people, they took turns
Dispute the suits, I ignite and then watch 'em burn

Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn (Yes, you're gonna)
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn

It goes a one, two, three, another funky, radical bombtrack
Started as a sketch in my notebook
And now dope hooks make punks take another look
My thoughts ya hear and ya begin to fear
That ya card will get pulled if ya interfere

With the thoughts from a militant mind
Hardline, hardline after hardline
Landlords and power whores, on my people, they took turns
Dispute the suits, I ignite and then watch 'em burn

Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn (Yes, you're gonna)
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn

In some cases this behavior is not desirable. You can use overscroll-behavior to prevent scrolls from chaining.

.inner {
  overscroll-behavior: none;
}
And suckers be thinkin' that they can fake this
But I'ma drop it at a higher level
'Cause I'm inclined to stoop down, hand out some beatdowns
Could run a train on punk fools that think they run the game
But I learned to burn that bridge and delete
Those who compete at a level that's obsolete
Instead, I warm my hands upon the flames of the flag
To recall the downfall and the businesses that burnt us all
See through the news and the views that twist reality
Enough, I call the bluff, fuck Manifest Destiny
Landlords and power whores, on my people, they took turns
Dispute the suits, I ignite and then watch 'em burn

With the thoughts from a militant mind
Hardline, hardline after hardline
Landlords and power whores, on my people, they took turns
Dispute the suits, I ignite and then watch 'em burn

Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn (Yes, you're gonna)
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn

It goes a one, two, three, another funky, radical bombtrack
Started as a sketch in my notebook
And now dope hooks make punks take another look
My thoughts ya hear and ya begin to fear
That ya card will get pulled if ya interfere

With the thoughts from a militant mind
Hardline, hardline after hardline
Landlords and power whores, on my people, they took turns
Dispute the suits, I ignite and then watch 'em burn

Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn (Yes, you're gonna)
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn
Burn, burn, yes, you're gonna burn

See on CodePen

Further reading

Do you want to learn even more awesome CSS?

I'm running a workshop with my friends at Smashing Magazine in which I introduce you to the most useful modern features in CSS and show how you can implement them today in your code base to improve scalability, maintainability, and productivity.

Learn more about the workshop!

Overview: 100 Days Of More Or Less Modern CSS