Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <main>
	<section>
		<h1>All gradients use the same start and stop colors</h1>

		<input type="checkbox" id="show-extended">
		<label for="show-extended">
			Show all color-interpolation-methods
		</label>

		<h2>srgb</h2>
		<div class="gradient srgb"></div>

		<h2 class="extended">srgb-linear</h2>
		<div class="gradient srgb-linear extended"></div>

		<h2>lab</h2>
		<div class="gradient lab"></div>

		<h2 class="extended">oklab</h2>
		<div class="gradient oklab extended"></div>

		<h2>xyz</h2>
		<div class="gradient xyz"></div>

		<h2 class="extended">xyz-d50</h2>
		<div class="gradient xyz-d50 extended"></div>

		<h2 class="extended">xyz-d65</h2>
		<div class="gradient xyz-d65 extended"></div>

		<h2>hsl</h2>
		<div class="gradient hsl"></div>

		<h2>hwb</h2>
		<div class="gradient hwb"></div>

		<h2>lch</h2>
		<div class="gradient lch"></div>

		<h2>oklch</h2>
		<div class="gradient oklch"></div>
	</section>
</main>
              
            
!

CSS

              
                /**
 * Try changing these colors to see how the
 * different interpolation methods handle it
 * 
 * @see https://oklch.com/
 * @see https://mdn.io/named-color
 */
:root {
	--color-start: oklch(74.11% 0.416 338.29);
	--color-end: oklch(82.46% 0.464 152.87);
}

/**
 * Set each gradient container to use the correct
 * color interpolation method.
 * 
 * @see https://mdn.io/color-interpolation-method
 */
.gradient {
	background: linear-gradient(
		to right in var(--color-interpolation-method),
		var(--color-start),
		var(--color-end)
	);
}

.srgb {
	--color-interpolation-method: srgb;
}

.srgb-linear {
	--color-interpolation-method: srgb-linear;
}

.lab {
	--color-interpolation-method: lab;
}

.oklab {
	--color-interpolation-method: oklab;
}

.xyz {
	--color-interpolation-method: xyz;
}

.xyz-d50 {
	--color-interpolation-method: xyz-d50;
}

.xyz-d65 {
	--color-interpolation-method: xyz-d65;
}

.hsl {
	--color-interpolation-method: hsl;
}

.hwb {
	--color-interpolation-method: hwb;
}

.lch {
	--color-interpolation-method: lch;
}

.oklch {
	--color-interpolation-method: oklch;
}

/******************************************************
 * Additional styles to make the demo look nice.
 *****************************************************/

* {
	box-sizing: border-box;
}

html {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
		Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
	font-size: 16px;
	line-height: 1.45;
}

body {
	background: radial-gradient(
			circle,
			oklch(0.1 0.15 200 / 0),
			oklch(0.1 0.15 200 / 0.75)
		),
		linear-gradient(344deg in oklch, oklch(0.2 0.1 150), oklch(0.2 0.2 220));
	background-blend-mode: multiply, normal;
	margin: 0;
}

:is(h1, h2) {
	margin: 0;
}

main {
	display: grid;
	gap: 1rem;
	min-height: 100svh;
	place-content: center;
}

@property --angle {
	inherits: false;
	initial-value: 0deg;
	syntax: "<angle>";
}

@keyframes spin {
	to {
		--angle: 360deg;
	}
}

section {
	align-items: center;
	animation: spin 20s linear infinite;
	background: linear-gradient(to bottom, oklch(1 0 220 / 0.95) 0 0) padding-box,
		conic-gradient(
				from var(--angle) in oklch,
				var(--color-start),
				var(--color-end),
				var(--color-start)
			)
			border-box;
	border: 0.125rem solid transparent;
	border-radius: 1rem;
	display: grid;
	gap: 0.25rem 1rem;
	grid-template-columns: 100px 1fr;
	padding: 1rem 2rem 1.5rem;
	position: relative;
	width: min(90vw, 600px);

	&::after {
		animation: spin 20s linear infinite;
		content: "";
		position: absolute;
		inset: 0;
		background: conic-gradient(
			from var(--angle) in oklch,
			var(--color-start),
			var(--color-end),
			var(--color-start)
		);
		filter: blur(3rem);
		opacity: 0.3;
		z-index: -1;
	}

	& h1 {
		font-size: 1.25rem;
		grid-column: span 2;
	}

	& h2 {
		font-size: 1rem;
		text-align: right;
	}

	& .gradient {
		aspect-ratio: 12 / 1;
		border-radius: 0.25rem;
		width: 100%;
	}
}

input {
	margin-block: 0.25rem 1rem;
	margin-inline-start: auto;
}

label {
	margin-block: 0.25rem 1rem;
}

.extended {
	display: none;
}

:checked ~ .extended {
	display: block;
}

              
            
!

JS

              
                // no JS!

              
            
!
999px

Console