How to Hide Scrollbar Using CSS
Last updated: 21.02.2026
Views: 271
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:
-
How to Center an Element Vertically Using CSS (Vertical Alignment)
There are several ways of vertical alignment. In different situations, different ways are suitable. Consider some of them. 1. Using Flexbox The easiest and most widely ...
-
How to Add a Favicon to a Website
A favicon (short for “favorite icon”) is a small graphical icon associated with a website. It is displayed in browser tabs, bookmarks, history lists, and sometimes in sea...
-
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