Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webkit scrollbar CSS, always a white box in corner

Is there any way to avoid the default white box that appears on a custom styled webkit scroll bar?

The white box only appears when overflow is going both horizontally and vertically. (Using Google Chrome)

Edit: I have tried setting body background to a different colour - still only seeing a white box.

Screenshot: enter image description here

CSS:

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border-radius: 5px;
  background: rgba(0,0,0,0.35);
}
::-webkit-scrollbar-corner {
  background: #0c0c0c;
}
like image 669
Richard Denton Avatar asked Mar 13 '16 09:03

Richard Denton


People also ask

How do I fix the scroll bar in CSS?

The easy fix is to use width: 100% instead. Percentages don't include the width of the scrollbar, so will automatically fit. If you can't do that, or you're setting the width on another element, add overflow-x: hidden or overflow: hidden to the surrounding element to prevent the scrollbar.

How do I change the scroll bar position in CSS?

We can use the CSS “::-webkit-scrollbar” property which is responsible for changing the shape, color, size, shade, shadow, etc. of the scroll bar. But, here the property which we will use is the direction property of CSS for changing the position of the scroll bar.


2 Answers

This is a little out of date, but in chrome, you can set background colour to rgba(0,0,0,0). Anything with alpha 0 and the box won't show :)!

::-webkit-scrollbar-corner {
  background: rgba(0,0,0,0);
}
like image 78
MishMash95 Avatar answered Sep 19 '22 14:09

MishMash95


As E.C.Pabon mentioned, you can use the

 ::-webkit-scrollbar-corner {background-color: red;}

tag, setting the background-color to transparent worked for me.

::-webkit-scrollbar-corner {background-color: transparent;}
like image 42
Irina Tyshkevich Avatar answered Sep 18 '22 14:09

Irina Tyshkevich