Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

19. CSS - Scrollbars

Lesson 19 of 34 in the free CSS Customization: Zero to Hero notes on Siksha Sarovar, written by Rohit Jangra.

CSS Scrollbars

While standard CSS has properties like overflow, styling scrollbars is essentially done using vendor-specific pseudo-elements (mainly WebKit for Chrome, Safari, Edge).

Overflow Property

The overflow property specifies what should happen if content overflows an element's box.

  • visible: Default. The overflow is not clipped.
  • hidden: The overflow is clipped, and the rest of the content will be invisible.
  • scroll: The overflow is clipped, and a scrollbar is added to see the rest of the content.
  • auto: Similar to scroll, but it typically adds scrollbars only when necessary.

Styling Scrollbars (WebKit)

You can use the following pseudo-elements to customize scrollbars in WebKit browsers:

  • ::-webkit-scrollbar: The scrollbar.
  • ::-webkit-scrollbar-button: The buttons on the scrollbar (arrows pointing upwards and downwards).
  • ::-webkit-scrollbar-thumb: The draggable scrolling handle.
  • ::-webkit-scrollbar-track: The track (progress bar) of the scrollbar.
  • ::-webkit-scrollbar-corner: The bottom corner of the scrollbar, where both horizontal and vertical scrollbars meet.
/* Width */
::-webkit-scrollbar {
  width: 10px;
}

/* Track */
::-webkit-scrollbar-track {
  background: #f1f1f1;
}

/* Handle */
::-webkit-scrollbar-thumb {
  background: #888;
}

/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
  background: #555;
}