Skip to content

Instantly share code, notes, and snippets.

@LeaVerou
Created January 1, 2012 17:04
Show Gist options
  • Save LeaVerou/1547789 to your computer and use it in GitHub Desktop.
Save LeaVerou/1547789 to your computer and use it in GitHub Desktop.
The -Webkit-scrollbar challenge
/**
* 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;
}
<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>
{"view":"split-vertical","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment