Customize the Dropdown Scrollbar with CSS

Flavio Corpa
InstructorFlavio Corpa
Share this video with your friends

Social Share Links

Send Tweet
Published 3 years ago
Updated 3 years ago

This is the only lesson in which we will fallback to CSS to give our dropdown's scrollbar a fancier look because this is very browser dependent and there is no way (yet) to do this with elm-ui.

We will target ::-webkit-scrollbar, ::-webkit-scrollbar-track, and ::-webkit-scrollerbar-thumb to get the scrollbar looking exactly how we want it.

Lecturer: [0:00] Now that our dropdown is looking awesome, there is one small change that we want to do, and it's to customize the dropdown's list of options scrollbar. For doing that, unfortunately we need to fall back to CSS.

[0:14] Let's now open our main CSS, and we need to add the following code, webkit-scrollbar. We're going to give it a weight of 20px. Now we say webkit-scrollbar-track, and we say that the background is going to be transparent.

[0:30] Now we want to highlight webkit-scrollbar-thumb. We're going to say the background color is going to be 9b9b9b. The border is going to be 7px solid transparent. The border width is going to be and 7px, the border-radius is going to be 8px, and finally, the background-clip is going to be content-box.

[0:59] Now, if we have a look at our scrollbar, it's looking much better, and this is the only piece of CSS that we're going to write in this whole Elm UI course.

egghead
egghead
~ 2 hours ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today