Sometimes, we want to disable scrolling on the body element with CSS.
In this article, we’ll look at how to disable scrolling on the body element with CSS.
How to disable scrolling on the body element with CSS?
To disable scrolling on the body element with CSS, we set overflow
to hidden
.
For instance, we write
html,
body {
margin: 0;
height: 100%;
overflow: hidden;
}
to set the overflow
style to hidden
to hide all scrollbars.
Conclusion
To disable scrolling on the body element with CSS, we set overflow
to hidden
.