public
Created

The -Webkit-scrollbar challenge

  • Download Gist
dabblet.css
CSS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
 
/**
* The -Webkit-scrollbar challenge
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Make the first div’s scrollbar like the second’s
* without changing the styling of the div (i.e. you
* can only change the ::-webkit-scrollbar-* rules
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
* It doesn't matter if the second div doesn't look the same
* after your changes, it's only there to show you how the
* end result should look.
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Basically the goal is to see if we can apply some kind
* of margin to the scrollbars to offset them from the edge
*/
div {
width: 350px;
height: 250px;
overflow: auto;
outline: 1px solid;
margin:10px;
box-sizing: border-box;
}
 
div:first-child {
padding: 10px;
}
 
div + div {
border: 10px solid transparent;
}
 
::-webkit-scrollbar {
width: 10px;
height: 10px;
position: relative;
margin:5px;
}
 
 
::-webkit-scrollbar-track,
::-webkit-scrollbar-thumb {
border-radius: 10px;
}
 
::-webkit-scrollbar-track {
box-shadow: 1px 1px 5px rgba(0,0,0,.2) inset;
}
 
::-webkit-scrollbar-thumb {
background: silver;
}
 
::-webkit-scrollbar-corner {
background: transparent;
}
 
/**
* The main trick is to play with transparent borders
*/
 
div:first-child::-webkit-scrollbar {
width: 30px;
height: 30px;
}
 
div:first-child::-webkit-scrollbar-track,
div:first-child::-webkit-scrollbar-thumb {
border: 10px solid transparent;
border-radius: 30px;
}
 
div:first-child::-webkit-scrollbar-thumb {
background: none;
box-shadow: silver 0 0 0 5px inset;
}
dabblet.html
HTML
1 2 3 4 5 6 7 8 9 10 11
<div>
Patch, metafile recursive bridgeware development pc integer backbone overflow, coordinated. High includes supporting supporting in patch n-tier integral analog high. Digital sampling high element interface bridgeware ethernet reducer supporting. Backbone feedback read-only digital technician infrared prototype bridgeware ethernet network. Controller boolean reflective pc logistically, normalizing, processor resistor potentiometer encapsulated bus disk.
Patch bypass bypass boolean pc reducer transistorized kilohertz potentiometer kilohertz, infrared. Developer video remote, prototype audio prototype. Broadband resistor hyperlinked femtosecond encapsulated internet femtosecond, supporting ethernet echo frequency.
Transponder arrray services developer, scan debugged. Bridgeware recursive metafile cache audio, feedback analog, bus reducer distributed. Integer developer read-only, bridgeware fragmentation, services fragmentation bridgeware n-tier partitioned processor. N-tier data resistor harmonic, messaging phaselock, adaptive arrray inversion.
</div>
 
<div>
Patch, metafile recursive bridgeware development pc integer backbone overflow, coordinated. High includes supporting supporting in patch n-tier integral analog high. Digital sampling high element interface bridgeware ethernet reducer supporting. Backbone feedback read-only digital technician infrared prototype bridgeware ethernet network. Controller boolean reflective pc logistically, normalizing, processor resistor potentiometer encapsulated bus disk.
Patch bypass bypass boolean pc reducer transistorized kilohertz potentiometer kilohertz, infrared. Developer video remote, prototype audio prototype. Broadband resistor hyperlinked femtosecond encapsulated internet femtosecond, supporting ethernet echo frequency.
Transponder arrray services developer, scan debugged. Bridgeware recursive metafile cache audio, feedback analog, bus reducer distributed. Integer developer read-only, bridgeware fragmentation, services fragmentation bridgeware n-tier partitioned processor. N-tier data resistor harmonic, messaging phaselock, adaptive arrray inversion.
</div>
settings.json
JSON
1
{"view":"split","seethrough":"1","prefixfree":"1","page":"css"}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.