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>Scroll-driven animations are cool!</h1>

<!-- if there's no support -->
<aside>
	<p class='box box--fail box--scrollani'>Sorry, your browser does no appear to support scroll-driven animation. As of April 2023, this is supported in Firefox starting with version 103 where the <kbd>layout.css.scroll-driven-animations.enabled</kbd> flag is set to true in <kbd>about:config</kbd> and in Chromium browsers starting with version 107 where the <strong>Experimental Web Platform features</strong> flag is enabled.</p>
</aside>
              
            
!

CSS

              
                html {
	height: 200%; /* force scrollbar */
	background: #000;
	scrollbar-color: orangered gainsboro;
	
	&::-webkit-scrollbar { width: .75em }
	&::-webkit-scrollbar-track { background: grey }
	&::-webkit-scrollbar-thumb { background: orange }
}

h1 {
	position: fixed; /* prevent scroll */
	top: 50%; left: 50%;
	margin: 0;
	width: 8em;
	/* % values for translation
	 * https://css-tricks.com/state-responsive-3d-shapes/#aa-values-for-various-css-properties */
	translate: -50% -50%;
	color: orange;
	font: clamp(.625em, 12.5vw, 8em)/ 1 julee;
	text-align: center;
	/* this does the text inversion magic, as explained in:
	 * https://css-tricks.com/taming-blend-modes-difference-and-exclusion/ */
	mix-blend-mode: exclusion;
	
	&:first-line {
		font-size: 75%;
		color: #fff
	}
}

/* styling support info boxes */
aside {
	position: fixed; /* prevent scroll */
	inset: 0 0 auto;
}

.box {
	margin: 1em;
	border-left: solid 5px #dc3055;
	padding: 1em;
	box-shadow: 2px 2px 5px hsla(0, 0%, 0%, .35);
	background: #851d40;
	color: #fff;
	font: 1.25em/ 1.25 ubuntu, trebuchet ms, arial, sans-serif
}

kbd, code {
	padding: 2px;
	background: hsla(0, 0%, 0%, .35);
	font: 1.1em/ 1.2 ubuntu mono, consolas, monaco, monospace
}

/* test for scroll-driven animations support */
@supports (animation-timeline: scroll()) {
	html::before {
		position: fixed; /* prevent scroll */
		inset: 0;
		background: #fff;
		transform-origin: 100%; /* attach to the right edge */
		animation: slide 1s linear forwards;
		/* on scroll() 
		 * https://developer.mozilla.org/en-US/docs/Web/CSS/animation-timeline/scroll */
		animation-timeline: scroll();
		content: ''
	}

	@keyframes slide {
		/* if you're using an older Chromium version 
		 * and the scroll animation is glitchy, 
		 * uncomment the `scale: 1` keyframe 
		 * for reference: 
		 * https://bugs.chromium.org/p/chromium/issues/detail?id=1415322 */
		0% { scale: 0 1 }
		/* not really needed if no bugs *
		100% { scale: 1 } /**/
	}
	
	/* if supported, remove no support warn */
	.box--fail.box--scrollani { display: none }
}
              
            
!

JS

              
                
              
            
!
999px

Console