Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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

              
                %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