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.

<html lang="en">
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>CSS Variables Demo</title>
	<p class="wildCodeSchool"><span class="wild">Wild </span><span class="code">Code </span><span class="school">School</span>
	<div class="messageBox">
		<p class="message">
			Hello <span>Wilders</span>!
	<div class="modifier">
		<form id="main">
			<label for="redCursor" class="redish">Red</label><br>
			<input type="range" min="0" max="255" value="245" name="redCursor" class="cursor1"><br>
			<label for="greenCursor" class="greenish">Green</label><br>
			<input type="range" min="0" max="255" value="100" name="greenCursor" class="cursor2"><br>
			<label for="blueCursor" class="blueish">Blue</label><br>
			<input type="range" min="0" max="255" value="20"name="blueCursor" class="cursor3">
/* I declare my css variables here. */
:root {
	/*the first three are "simple" ones as opposed to "compound" ones*/
  	--red: 125;
		--green: 125;
		--blue: 255; 
	/* and the following two are compound ones: */
		--mainColor: var(--red), var(--green), var(--blue); 
		--secondaryColor: var(--blue), var(--red), var(--green);	
	/* you can think of other ways to compose your secondary colors; like adding or substracting 10 to the JS values...*/

/* So you can use a variables on different sorts of attributes. 
Here I'll use var(--mainColor):
on a linear gradient, 
on a border, 
on a font-color'*/

body {
		background: linear-gradient(to bottom left, rgba(var(--mainColor), 0.5),rgba(var(--secondaryColor), 0.5));
		background-repeat: no-repeat;
		background-attachment: fixed;

.messageBox {	
	border: 10px solid rgb(var(--mainColor));
	width: 50%;
	margin: auto;
	margin-top: 70px;
	margin-bottom: 30px;
	overflow: hidden;

.message {
	color: rgb(var(--secondaryColor));
	font-size: 5rem;
	padding: 0 5% 0 5%;
	text-align: center;

.message span {
	color: rgba(var(--mainColor));

.wildCodeSchool {
	text-align: center;
	font-size: 3em;

.wild {
	color: rgb(var(--red), 0, 0);

.code {
	color: rgb(0, var(--green), 0);

.school {
	color: rgb(0, 0, var(--blue));

.modifier {
	font-size: 1.5em;
	margin: auto;	
	text-align: left;
	width: 50%;

.redish {
	color: rgb(var(--red), 0, 0);

.greenish {
	color: rgb(0, var(--green), 0);

.blueish {
	color: rgb(0, 0, var(--blue));

@media  (max-width: 768px){	
	.message {
		font-size: 2.5em;

	.modifier {
		border: 5px solid rgb(var(--secondaryColor));
		color: rgb(var(--mainColor));
		font-size: 0.8em;
		min-width: 186px;

              const root = document.documentElement;
const red = document.querySelector(".cursor1");
red.addEventListener('input', () => getRedValue(event));
const getRedValue = event => {
	let redVal =;'--red', redVal);

const green = document.querySelector(".cursor2");
green.addEventListener('input', () => getGreenValue(event));
const getGreenValue = event => {
	let greenVal =;'--green', greenVal);	

const blue = document.querySelector(".cursor3");
blue.addEventListener('input', () => getBlueValue(event));

const getBlueValue = event => {
	let blueVal =;'--blue', blueVal);

// Many thanks to Ohans Emmanuel! 
// I followed his tuto
🕑 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.