Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

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.

		- for (i = 0; i < 13; i++)

p Amazing drawings by 
	a(href="" target="_blank") Kuvshinov Ilya
              // Import a font
@import url('')

	box-sizing border-box

poscenter(m=50%, n=m, tf=)
	position absolute
	left m
	top n
	transform translate(-@left, -@top) tf

	background #2f2f31
	min-height 100vh
	color #f
	perspective 600px
	overflow hidden

	poscenter(,,rotateX(4deg) translateY(-3%))
	width 80%
	height 90vh
	max-height 768px

		content ""
		width 1rem
		height 100%
		left calc(50% - .5rem)
		background-color #08
		z-index -1
		border-top-right-radius 16px 6px
		border-bottom-right-radius 16px 6px

		left calc(50% + .5rem)
		border-top-left-radius 16px 6px
		border-bottom-left-radius 16px 6px

.book div // pages
	background-color #b5
	width 50%
	height 100%
	position absolute
	top 0
	right calc(50% + .5rem)
	overflow auto

	& + div
		right auto
		left calc(50% + .5rem)

	height 90%
	width 3rem
	display flex
	flex-direction column
		height 100%
		position relative

			content ""
			width 6px
			height 8px
			border-radius 25%
			poscenter(1%, 50%)
			background-color black
			z-index -5
			poscenter(99%, 50%)

			border-radius 50%
			width: 3rem
			border-style solid
			border-color grey transparent transparent transparent
			border-width 5px 4px 0 4px
			z-index 5
		transform rotate(180deg)

	for i in 1..13
			top calc(50% - size)
		li:nth-of-type({i}) span
			height abs(-18px+i*2)

	text-align center
	padding 2.5%
	overflow auto

		max-width 20%
		min-width  48px
		max-height 200px
		width auto
		height auto
		background-color #f
		padding .5rem
		margin .5rem
		display inline-block
		transition 1.5s

			transform scale(1.04)
			box-shadow 0 4px 16px #0003

.page-right img
	max-width 85%
	max-height 85%
	opacity 0
	transition .8s, opacity .45s .15s
	filter blur(32px)
	background-color #f
	padding 1rem

		filter blur(0px)
		opacity 1

	color #576
	font-family Sunflower
	font-size 0.8rem

		color #697
              let sources = [

let imgTag,

for (let i = 0; i < sources.length; i++) {
	imgTag = document.createElement('img')
	imgTag.src = sources[i]
	if (i == 0) imgTag.classList.add('active')
	clonedTag = imgTag.cloneNode(true)

const imgs = document.querySelectorAll('.page-left img')
let orig,

for (let i = 0; i < imgs.length; i++) {
	imgs[i].addEventListener('click', function () {
		if (this.classList.contains('active')) return false

		orig =, document.querySelector('.page-left'))
		curr =, this)

		document.querySelectorAll('.page-left img')[orig].classList.remove('active')
		document.querySelectorAll('.page-right img')[orig].classList.remove('active')
		document.querySelectorAll('.page-left img')[curr].classList.add('active')
		document.querySelectorAll('.page-right img')[curr].classList.add('active')

		return false

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.