Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                %h1 Custom CSS Scrollbar

.demo
	%h2 Default
	.scrollbar
		.fake-content
		
.demo
	%h2 Dark
	.scrollbar.scrollbar--dark
		.fake-content
		
.demo
	%h2 Light
	.scrollbar.scrollbar--light
		.fake-content
		
.demo
	%h2 Light Reversed
	.scrollbar.scrollbar--light-reversed
		.fake-content
		
.demo
	%h2 Seafoam
	.scrollbar.scrollbar--seafoam
		.fake-content

.demo
	%h2 Extreme
	.scrollbar.scrollbar--extreme
		.fake-content
	
              
            
!

CSS

              
                $blue: #3498db
$green: #1abc9c
$red: #c0392b
$stone: #bdc3c7
$slate: darken($stone, 50)
$yellow: #f1c40f

html
	overflow-y: scroll
	padding: 5%
	background: $stone

img
	max-width: 100%
	vertical-align: bottom

h2
	font-size: 1.1rem

// Demo
// ----

.demo
	float: left
	height: 400px
	margin: 0 1em 0 0
	padding: 0 0 3em
	width: 170px

.scrollbar
	background: #fff
	height: 100%
	overflow: auto
	-webkit-overflow-scrolling: touch
	
.fake-content
	height: 200%
	width: 400%
	$line-color: rgba(#000, .1)
	$line-size: 1px
	$space-between: 50px
	background-image: linear-gradient(to right, $line-color $line-size, transparent $line-size), linear-gradient(to bottom, $line-color $line-size, transparent $line-size)
	background-size: $space-between $space-between


// Sass mixin that customizes the browser scrollbar
//
// $thumb-color - moving part of the scrollbar
// $track-color - background of the scrollbar
// $variation - 'lighten' or 'darken'
// $size - horizontal width and vertical height of the scrollbar
=scrollbars($thumb-color: #606060, $track-color: #393939, $variation: 'lighten', $size: 10px)
	// Firefox:
	// https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Scrollbars
	scrollbar-color: $thumb-color $track-color

	@if $size < 15px
		scrollbar-width: thin

	// Webkit:
	// https://developer.mozilla.org/en-US/docs/Web/CSS/::-webkit-scrollbar

	&::-webkit-scrollbar
		height: $size
		width: $size
		background-color: red

	&::-webkit-scrollbar-corner
		background: $track-color

	&::-webkit-scrollbar-thumb
		background: $thumb-color
		border: 1px solid $track-color

		&:hover
			@if $variation == 'lighten'
				background: lighten($thumb-color, 15)
			@if $variation == 'darken'
				background: desaturate(darken($thumb-color, 40), 20)
	
		// &:active
		// 	@if $variation == 'lighten'
		// 		background: lighten($thumb-color, 30)
		// 	@if $variation == 'darken'
		// 		background: desaturate(darken($thumb-color, 50), 20)

	&::-webkit-scrollbar-track
		border: 1px solid $track-color
		background-color: $track-color

//
// Variations

.scrollbar--dark
	+scrollbars
	background: rgba(#1c1c1c, .7)

.scrollbar--light
	+scrollbars(#eaeaea, #d4d4d4, 'darken')

.scrollbar--light-reversed
	+scrollbars(#d4d4d4, #eaeaea, 'darken')
	
.scrollbar--seafoam
	+scrollbars(#def1ee, #bcd7d2, 'darken')
	
.scrollbar--extreme
	+scrollbars(gold, crimson, 'lighten', 40px)

              
            
!

JS

              
                
              
            
!
999px

Console