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 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

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

              
                #app
	#preview
		#box
	#shadow-settings
		.input-group
			label(for='horizontal')
				| Horizontal Offset: 
				span#horizontal-label 0px
			input#horizontal(type='range', name='horizontal', min='-50', max='50', step='1', value='0')
		
		.input-group
			label(for='vertical')
				| Vertical Offset: 
				span#vertical-label 0px
			input#vertical(type='range', name='vertical', min='-50', max='50', step='1', value='0')
		
		.input-group
			label(for='expansion')
				| Expansion: 
				span#expansion-label 0px
			input#expansion(type='range', name='expansion', min='-50', max='50', step='1', value='0')
		
		.input-group
			label(for='blur')
				| Blur: 
				span#blur-label 4px
			input#blur(type='range', name='blur', min='0', max='100', step='1', value='4')
		
		.input-group
			label(for='opacity')
				| Opacity: 
				span#opacity-label 0.3
			input#opacity(type='range', name='opacity', min='0', max='1', step='0.01', value='0.3')
		
		#color-group.input-group
			label(for='bgc') Background:
			input#bgc(type="color", name='bgc', value='#c8c8c8')
			
			label(for='shc') Shadow:
			input#shc(type="color", name='shc', value='#000000')
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css?family=Roboto:400,400i,700")

*
	box-sizing: border-box

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

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

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

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

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

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

JS

              
                console.clear();

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(`#${el.id}-label`);
	label.innerText = el.id != '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})`;
	box.style.boxShadow = shadow;
}; sbs();

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

bgc.onchange = (e) => preview.style.backgroundColor = bgc.value;
              
            
!
999px

Console