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.

				| Horizontal Offset: 
				span#horizontal-label 0px
			input#horizontal(type='range', name='horizontal', min='-50', max='50', step='1', value='0')
				| Vertical Offset: 
				span#vertical-label 0px
			input#vertical(type='range', name='vertical', min='-50', max='50', step='1', value='0')
				| Expansion: 
				span#expansion-label 0px
			input#expansion(type='range', name='expansion', min='-50', max='50', step='1', value='0')
				| Blur: 
				span#blur-label 4px
			input#blur(type='range', name='blur', min='0', max='100', step='1', value='4')
				| Opacity: 
				span#opacity-label 0.3
			input#opacity(type='range', name='opacity', min='0', max='1', step='0.01', value='0.3')
			label(for='bgc') Background:
			input#bgc(type="color", name='bgc', value='#c8c8c8')
			label(for='shc') Shadow:
			input#shc(type="color", name='shc', value='#000000')
              @import url(",400i,700")

	box-sizing: border-box

html, body
	padding: 0
	margin: 0
	font-family: 'Roboto'

html, body, #app
	width: 100%
	height: 100%

	display: grid
	grid-template: 75vh auto / 1fr

	background-color: rgb(239, 239, 239)
	height: 75vh
	box-shadow: inset 0 0 50px rgba(#000, .25)
	position: relative

		background-color: #fff
		width: 300px
		height: 300px
		border-radius: 12px
		// centering
		position: absolute	
		top: 50%
		left: 50%
		transform: translate(-50%, -50%)
	padding: 8px
	display: grid
	grid-template: repeat(3, 1fr) / repeat(2, 1fr)
	text-align: center
	padding: 4px
	position: relative
	top: 50%
	transform: translatey(-50%)

		display: block
		text-transform: uppercase
		font-size: 13px
		font-weight: bold
		letter-spacing: 0.5px
		color: rgba(0, 0, 0, .8)
	display: grid
	grid-template: 1fr / 1fr 1fr

const app = document.querySelector('#app'),
			preview = document.querySelector('#preview'),
			box = document.querySelector('#box');

const h = document.querySelector('#horizontal'),
			v = document.querySelector('#vertical'),
			b = document.querySelector('#blur'),
			e = document.querySelector('#expansion'),
			o = document.querySelector('#opacity'),
			bg = document.querySelector('#bgc'),
			shc = document.querySelector('#shc');

function updateLabel(el) {
	let label = document.querySelector(`#${}-label`);
	label.innerText = != 'opacity' ? el.value + 'px' : el.value;

function rgb(hexc) {
	return hexc.match(/[A-Za-z0-9]{2}/g).map(function(v) { return parseInt(v, 16) }).join(",");

function sbs() {
	let shadow = `${h.value}px ${v.value}px ${b.value}px ${e.value}px rgba(${rgb(shc.value)}, ${o.value})`; = shadow;
}; sbs();

document.querySelectorAll('input').forEach(i => {
	i.onmousemove = (e) => { sbs(); updateLabel( };
	i.onchange = (e) => { sbs(); updateLabel( };

bgc.onchange = (e) => = bgc.value;
🕑 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.