Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

white corners webkit-scrollbar

Tags:

html

css

webkit

Fiddle

I am using ::-webkit-scrollbar to make a custom scrollbar in Chrome. I have a border-radius: 10px and in doing that, there are white corners at the top:

It's kinda hard to see

Sorry, it's kinda hard to see since it's a scrollbar.

I want the corners to be the same color as the header div (#dadae3). Is there any way to get rid of the white corners using CSS only without changing the styles of the scrollbar?

CSS (entire):

body {   padding: 0;   margin: 0 } ::-webkit-scrollbar {   width: 13px; } ::-webkit-scrollbar-track {   background: #ffffff;   border-radius: 10px;   border: 1px solid #aeaeb5 } ::-webkit-scrollbar-thumb {   background: #dadae3;   border-radius: 10px;   border: 1px solid #aeaeb5 } ::-webkit-scrollbar-thumb:hover {   background: #c4c4cc } ::-webkit-scrollbar-thumb:active {   background: #aeaeb5 } 

HTML:

<div style='background: #dadae3; width: 100%; height: 30px;'></div> <div style='width: 100%; height: 1000px'></div> 
like image 852
Joe Pigott Avatar asked Nov 27 '13 02:11

Joe Pigott


People also ask

What is Webkit scrollbar corner?

::-webkit-scrollbar-corner — the bottom corner of the scrollbar, where both horizontal and vertical scrollbars meet. This is often the bottom-right corner of the browser window.

How do I use the Webkit scrollbar button?

For the webkit browsers, you can use the following pseudo elements to customize the browser's scrollbar: ::-webkit-scrollbar : the scrollbar. ::-webkit-scrollbar-button : the arrows that point up or down on the scrollbar. ::-webkit-scrollbar-thumb : the scrolling handle that can be dragged.

How do I make my scrollbar visible all the time?

Make sure overflow is set to "scroll" not "auto." With that said, in OS X Lion, overflow set to "scroll" behaves more like auto in that scrollbars will still only show when being used.


2 Answers

You have to set the ::-webkit-scrollbar-corner pseudo-element, e.g.

::-webkit-scrollbar-corner { background: rgba(0,0,0,0.5); } 
like image 74
Jasdeep Khalsa Avatar answered Sep 30 '22 16:09

Jasdeep Khalsa


You can set the background-color property for the pseudo-element -webkit-scrollbar, doing that you can set the "corner color".

like image 36
Carlo Cannas Avatar answered Sep 30 '22 16:09

Carlo Cannas