How to Hide Scrollbar Using CSS
Last updated: 21.02.2026
Views: 381
There are several ways to hide the scrollbar using CSS, depending on whether you want to completely remove scrolling or just hide the visual appearance of the scrollbar.
Hide the Scrollbar but Keep Scrolling
To hide the scrollbar visually while still allowing scrolling:
/* For modern browsers */
.block {
overflow: auto; /* or scroll */
scrollbar-width: none; /* Firefox */
}
.block::-webkit-scrollbar {
display: none; /* Chrome, Safari */
}
Completely Disable Scrolling
If you want to disable scrolling entirely (and hide the scrollbar):
.block {
overflow: hidden;
}
This method blocks both vertical and horizontal scrolling.
Hide Only Horizontal or Vertical Scrollbars
Only Horizontal:
.block {
overflow-x: hidden;
}
Only Vertical:
.block {
overflow-y: hidden;
}
For the Entire Page
To hide the scrollbar across the entire document:
html, body {
overflow: hidden;
}
If you want the content to remain scrollable but just hide the scrollbar, use the first method.
Similar posts:
-
Infinite Rotation with CSS Animation
One simple yet effective technique is creating an infinitely rotating element. This kind of animation can be used to attract attention to specific parts of a page, such a...
-
How to Create a Drop Down Menu Using only HTML and CSS
In one of the previous articles, we looked at creating a drop down menu using JavaScript (jQuery). In this article, we will look at how to make a drop down menu using onl...
-
Image Scaling Problem in Outlook
Creating HTML email layouts is a fairly complex and not always enjoyable process. This is mainly due to the fact that many email clients do not support modern web standar...
Leave a Reply