I styled the scrollbar of my website for webkit, and I put the background of the track as transparent, however I would like the thumb to overlap the body content, simulating a position absolute effect, and the body 100% without leaving the padding to the track, how can I do this? Example of how it is:
Iwouldlikethebodytooccupytheentirelengthofthewindow,occupyingtheinclusivespaceofthetracktolooklikethis:
AlthoughthecodethatMarcosHenzelworkedwellhere,forsomereasondidnotworkonthesite,soImadea"hackzinho" to get the effect I wanted and the code was as follows:
body{
width:100%;
height:100%;
position:absolute;
overflow-y:scroll;
background-color:#312d28;
font-family:'Ebrima';
margin:10px;
top:-10px;
left:-10px;
padding-right:14px;
}
body::-webkit-scrollbar {
width: 14px;
}
body::-webkit-scrollbar-thumb {
height: 6px;
border: 4px solid rgba(0, 0, 0, 0);
background-clip: padding-box;
-webkit-border-radius: 7px;
background-color: rgba(255, 255, 255, 0.7);
}
body::-webkit-scrollbar-button {
width: 0;
height: 0;
display: none;
}
body::-webkit-scrollbar-corner {
background-color: transparent;
}
That way I get the effect exactly the same as the sample image. Applying a margin to the body and then pulling it back with the properties left
and top
and then I put a padding-right
to pull the body in the space that the scrollbar takes up. Image below: