Pen Settings



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


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


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.


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.


	<button type="button" data-theme-set="dark">Dark</button>
	<button type="button" data-theme-set="light">Light</button>
	<button type="button" data-theme-set="bare">Bare</button>

	<h2>Of Black Quartz</h2>
	<h3>Judge My Vow</h3>
	<p>The quick brown fox jumps over the lazy dog.</p>
	<p>Learn more about the basic idea here: <a href="" target="_top">A DRY Approach to Color Themes in CSS</a>


                @property --heading-tracking {
	syntax: '<length-percentage>';
	inherits: true;
	initial-value: 0;
@property --corner-radius {
	syntax: '<length-percentage>';
	inherits: true;
	initial-value: 0;
@property --heading-transform {
	syntax: 'none | uppercase | lowercase';
	inherits: true;
	initial-value: 'none';

:root {
	--ON: initial;
	--OFF: ;
	--type-0: clamp(1rem, 0.8rem + 0.98vw, 1.5rem);
	--type-1: clamp(1.33rem, 1.15rem + 0.91vw, 1.8rem);
	--type-2: clamp(1.78rem, 1.63rem + 0.75vw, 2.16rem);
	--type-3: clamp(2.37rem, 2.28rem + 0.44vw, 2.59rem);
	--type-4: clamp(3.11rem, 3.18rem - 0.09vw, 3.16rem);
	--type-5: clamp(3.73rem, 4.39rem - 0.93vw, 4.21rem);
	--size-2xs: clamp(0.5rem, 0.4rem + 0.49vw, 0.75rem);
	--size-xs: clamp(0.75rem, 0.6rem + 0.73vw, 1.13rem);
	--size-s: clamp(1rem, 0.8rem + 0.98vw, 1.5rem);
	--size-m: clamp(1.5rem, 1.21rem + 1.46vw, 2.25rem);
	--size-l: clamp(2rem, 1.61rem + 1.95vw, 3rem);
	--size-xl: clamp(3rem, 2.41rem + 2.93vw, 4.5rem);
	--size-2xl: clamp(4rem, 3.22rem + 3.9vw, 6rem);

:root {
        var(--_theme-dark, hsl(225deg, 15%, 95%))
		var(--_theme-light, hsl(233deg, 12%, 13%));
        var(--_theme-dark, hsl(227deg, 5%, 63%))
		var(--_theme-light, hsl(231deg, 3%, 46%));
        var(--_theme-dark, hsl(233deg, 12%, 13%))
		var(--_theme-light, hsl(39deg, 100%, 96%));
        var(--_theme-dark, hsl(33deg, 100%, 88%))
		var(--_theme-light, hsl(261deg, 100%, 31%));
        var(--_theme-dark, hsl(325deg, 100%, 50%))
		var(--_theme-light, hsl(295deg, 70%, 45%));
        var(--_theme-dark, hsl(263deg, 45%, 13%))
		var(--_theme-light, hsl(331deg, 95%, 92%));
        var(--_theme-dark, hsl(254deg, 39%, 85%))
		var(--_theme-light, hsl(193deg, 94%, 20%));
        var(--_theme-dark, hsl(177deg, 77%, 44%))
		var(--_theme-light, hsl(182deg, 86%, 30%));
        var(--_theme-dark, hsl(195deg, 90%, 12%))
		var(--_theme-light, hsl(167deg, 100%, 86%));
		var(--_theme-dark, Impact, system-ui)
		var(--_theme-light, monospace)
		var(--_theme-bare, serif);
		var(--_theme-dark, sans-serif)
		var(--_theme-light, monospace)
		var(--_theme-bare, serif);
	// These could be defined with the default here and then reassigned for the selected theme or media query, but that breaks the DRY concept I'm trying to follow
	// Also duplicating the var with the underscore was my initial try at having `--prop: var(--_prop, default-value)` and I got too lazy to remove them for now.
		var(--_theme-dark, var(--size-m))
		var(--_theme-bare, 8px);
	--corner-radius: var(--_corner-radius);
	--_heading-tracking: var(--_theme-dark, 0.05em);
	--heading-tracking: var(--_heading-tracking);
	--_heading-transform: var(--_theme-light, uppercase);
	--heading-transform: var(--_heading-transform);
	--_theme-dark: var(--OFF);
	--_theme-light: var(--OFF);
	--_theme-bare: var(--OFF);
@media screen and (prefers-color-scheme: light) {
	:root:not([data-theme]) {
		--_theme-light: var(--ON);
@media screen and (prefers-color-scheme: dark) {
	:root:not([data-theme]) {
		--_theme-dark: var(--ON);
:root[data-theme="dark"] { --_theme-dark: var(--ON); }
:root[data-theme="light"] { --_theme-light: var(--ON); }
:root[data-theme="bare"] { --_theme-bare: var(--ON); }


*, *::before, *::after {
	box-sizing: border-box;

body {
	padding: 1rem;
	font-family: var(--f-body);
	color: var(--c-primary-min);
	background-color: var(--c-primary-max);
h3 {
	font-family: var(--f-heading);
	letter-spacing: var(--heading-tracking);
	text-transform: var(--heading-transform);
button {
	font: inherit;
	border: 1px solid;
	border-radius: var(--corner-radius);
:any-link {
	color: var(--c-primary-med);


                const e = ["dark", "light", "bare"];
const t = { dark: "dark", light: "light" };
const a = "cknTheme";
setTheme = function (t) {
	e.includes(t) &&
		(document.documentElement.setAttribute("data-theme", t),
		 localStorage.setItem(a, t));
var r = localStorage.getItem(a);
e.includes(r) ||
	(r =
	window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"

document.addEventListener("click", function (evt) {
	var el ="[data-theme-set]");
	el && window.setTheme(el.getAttribute("data-theme-set"));