cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

            
              <form>
	<input id='r' type='range' min='10' value='50' max='80'/>
	<label for='r'>--r: <output for='r'>50</output></label>
</form>

<div class='box'>	
	<h3>Amur leopard</h3>
	
	<p>The Amur leopard has some very distinguishing features. The hairs of its summer pelt are 2.5 cm long but in winter they are replaced by 7 cm long ones.</p>
	
	<p>Apart from its long winter coat, which is a light colour in the winter, and more reddish-yellow in the summer, the Amur leopard is easily told apart from other leopard subspecies by its widely spaced rosettes with thick borders. It also has longer legs, probably an adaptation for walking through snow.</p>
	
	<em>from <a href='http://wwf.panda.org/what_we_do/endangered_species/amur_leopard2/'>wwf.panda.org</a></em>
</div>
            
          
!
            
              $theme-dark: #262626;
$theme-light: invert($theme-dark);
$theme-orange: #f90;
$theme-tomato: #b53;
$theme-purple: #95a;

$grad-list: ();

@for $i from 0 to 4 {
  $grad-list: $grad-list, 
		radial-gradient(circle at ($i%2)*100% floor($i/2)*100%, var(--stop-list))
}

.box {
	--stop-list: #000 var(--r), transparent 0;
	position: relative;
	margin: 2em auto;
	padding: var(--r);
	width: calc(100% - 2*var(--r) - 1em);
	max-width: 47em;
	min-height: 10em;
	background: $theme-orange;
	-webkit-mask: $grad-list;
					mask: $grad-list;
	color: #fff;
	font: 1em trebuchet ms, verdana, sans-serif;
}

svg {
	position: absolute;
	top: 0; left: 0;
	z-index: -1;
	width: 100%; height: 100%;
}

[id='c'] { r: var(--r) }

/* JUST PRETTYFYING STUFF, NOT ESSENTIAL FOR A WORKING DEMO */

//* slider variables */
$track-w: 90vw;
$track-h: .25em;
$thumb-d: 1.5em;

//* slider mixins */
@mixin track() {
	box-sizing: border-box;
	border: none;
	width: 100%; height: $track-h;
	border-radius: $track-h;
	background: $theme-light
}

@mixin thumb() {
	box-sizing: border-box;
	border: none;
	width: $thumb-d; height: $thumb-d;
	border-radius: 50%;
	background: currentcolor
}

* {
	margin: 0;
	color: inherit;
	font: inherit
}

html {
	$over-c: rgba($theme-light, .5);
	overflow-x: hidden;
	min-width: 10em; height: 100%;
	background: 
		linear-gradient($over-c, $over-c), 
		url(https://images.unsplash.com/photo-1510920018318-3b4dfe979e4d?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=1080&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=76eda3022d9860f69a7fc7a94e46c3e6) 0 0/ cover
}

h3 {
	font: 2em/1.5 kalam, cursive;
	text-align: center;
}

p { padding: .75em 0; }

em {
	display: block;
	font-style: italic;
	text-align: right
}

a { color: #405 }

form {
	padding: .75em;
	background: $theme-dark;
	color: $theme-light;
	font: 1.125em/2 consolas, monaco, monospace;
	text-align: center
}

[type='range'] {
	&, &::-webkit-slider-thumb {
		-webkit-appearance: none;
	}
	
	display: block;
	margin: 0 auto 1em;
	padding: 0;
	width: $track-w; height: $thumb-d;
	background: transparent;
	cursor: pointer;
	
	&::-webkit-slider-runnable-track {
		@include track
	}
	&::-moz-range-track { @include track }
	&::-ms-track { @include track }
	
	&::-webkit-slider-thumb {
		margin-top: .5*($track-h - $thumb-d);
		@include thumb
	}
	&::-moz-range-thumb { @include thumb }
	&::-ms-thumb {
		margin-top: 0;
		@include thumb
	}
	
	&::-ms-tooltip { display: none }
	
	&:focus {
		outline: solid 1px transparent;
		color: $theme-orange;
		
		+ label output { color: $theme-orange }
	}
}

output:after { content: 'px' }
            
          
!
            
              const _R = document.getElementById('r'), 
			_O = _R.nextElementSibling.querySelector('output');

let v;

function update() {
	if(v !== +_R.value) {
		document.body.style.setProperty(`--r`, `${_O.value = v = +_R.value}px`)
	}
};

update();

_R.addEventListener('change', update, false);
_R.addEventListener('input', update, false);
            
          
!
999px
🕑 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.
Loading ..................

Console