Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put some space between webkit scrollbar and screen edge

I've got this css code that makes a webkit scrollbar.

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

This will make a scrollbar that will be right next to the screen edge. Is there any way that I can put some space between the screen edge and the scrollbar?

like image 632
Daniel Silva Avatar asked Feb 20 '23 04:02

Daniel Silva


1 Answers

Here is an interesting solution to what I think you are talking about; they actually put padding/position on the body element:

body {
    position: absolute;
    top: 20px;
    left: 20px;
    bottom: 20px;
    right: 20px;
    padding: 30px; 
    overflow-y: scroll;
    overflow-x: hidden;
}
like image 123
Phil Avatar answered Mar 08 '23 17:03

Phil