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

              
                <h1>Yellow Fade Technique with Modern CSS</h1>

<p>Modern version to the infamous <a href="https://signalvnoise.com/archives/000558.php" target="_top">Yellow Fade Technique</a>, using <code>@starting-style</code>.</p>

<pre><code>div {
	transition: background-color 0.5s;
	background-color: transparent;
	
	@starting-style {
		background-color: yellow;
	}
}</code></pre>

<p>Compare this approach to a <a href="https://codepen.io/Mestika/pen/KVGwKb" target="_top">classic approach</a>. See <a href="https://brm.us/starting-style" target="_top">https://brm.us/starting-style</a> for more info.</p>

<h2>Try it</h2>

<p><em>Requires Chrome Canary 115.0.5788.0 with “Experimental Web Platform Features” enabled, for now</em></p>

<button>Add div</button>

<main></main>
              
            
!

CSS

              
                div {
	transition: background-color 0.5s;
	background-color: transparent;
	
	display: inline-block;
	height: 2em;
	width: 2em;
	outline: 1px solid #ccc;
	margin: 0.5em;
	
	@starting-style {
		background-color: yellow;
	}
}


/* Non-demo styles below */
@layer base {
	@layer reset {
		* {
			box-sizing: border-box;
		}
		body {
			margin: 0;
			padding: 0;
		}
		html, body {
			min-height: 100%;
		}
	}
	@layer layout {
		html {
			max-width: 90ch;
			padding: 3rem 2rem;
			margin: auto;
/* 			line-height: 1.5;
			font-size: 1.25rem; */
		}

		a,
		a:visited {
			color: blue;
		}
		
		h2 {
			margin-top: 2em;
		}
		
		footer {
			margin-top: 4em;
			text-align: center;
			font-style: italic;
		}

	}
	
	@layer code {
		pre {
			border: 1px solid #dedede;
			padding: 1em;
			background: #f7f7f7;
			font-family: "Courier 10 Pitch", Courier, monospace;
			overflow-x: auto;
			border-left: 0.4em solid cornflowerblue;
			tab-size: 4;
		}
		
		code:not(pre code), output:not(code:has(output) output) {
			background: #f7f7f7;
			border: 1px solid rgb(0 0 0 / 0.2);
			padding: 0.1rem 0.3rem;
			margin: 0.1rem 0;
			border-radius: 0.2rem;
			display: inline-block;
		}
	}
}
              
            
!

JS

              
                document.querySelector('button').addEventListener('click', e => {
	const $newDiv = document.createElement('div');
	document.querySelector('main').appendChild($newDiv);
});
              
            
!
999px

Console