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

              
                <input type="checkbox" id="debug" />

<main>
	<h1>The Polar Bear</h1>
	
	<p><b>This is a demo for <a href="https://brm.us/scroll-triggered-animations" target="_top">https://brm.us/scroll-triggered-animations</a>, which explains how the code works.</b></p>
	
	<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer mattis turpis eu neque tincidunt lacinia. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam auctor ultrices tortor et volutpat. Donec eu semper orci, eu fermentum orci. Vivamus aliquam lobortis egestas. Proin vel mauris vitae sem auctor cursus. Aenean sit amet odio at magna pharetra luctus nec eget urna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Praesent in leo at tellus ultricies laoreet.</p>

	<p>Nam pulvinar congue condimentum. Pellentesque fringilla ante sed massa tincidunt feugiat. Nulla bibendum est eros, non malesuada dolor vehicula in. Morbi eu cursus arcu. Phasellus ultricies ornare lorem, non interdum orci condimentum eu. Donec condimentum condimentum ligula ut placerat. Vestibulum id neque condimentum, molestie nunc vel, suscipit turpis. Quisque orci velit, mattis et nibh non, tempor finibus erat. Nullam tristique, tortor non commodo cursus, magna turpis rhoncus leo, quis porta quam ante sed orci. Nunc vehicula imperdiet leo in vulputate. Quisque quis dolor orci.</p>

	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
	<p class="text-center"><span class="debugwrapper"><img src="https://assets.codepen.io/89905/photo-1610570426407-efa770f9d31a.jpeg" alt="" title="" width="1080" height="720" class="revealing-image" /></span></p>
		
	<p><a href="https://unsplash.com/photos/PX_1j-M59I8">Polar bear walking</a> by <a href="https://unsplash.com/@dtbosse">Daniel Bosse</a></p>
</main>
              
            
!

CSS

              
                /* Scroll-Triggered */
@keyframes flipthebit {
	from {
		--bit: 0;
	}
	to {
		--bit: 1;
	}
}

:has(> .revealing-image) {
	display: block;
	animation: flipthebit linear both;
	animation-timeline: view();
	animation-range: contain 25% contain 25%;
}

.revealing-image {
	transition: all 0.5s ease-in-out;
}
@container style(--bit: 0) {
	.revealing-image {
		opacity: 0;
		clip-path: inset(0% 60% 0% 50%);
	}
}
@container style(--bit: 1) {
	.revealing-image {
		opacity: 1;
		clip-path: inset(0% 0% 0% 0%);
	}
}


@layer support {
	.columns {
		display: flex;
		flex-direction: row;
		gap: 2em;
	}
	/* Debug */
	#debug {
		position: fixed;
		top: 1em;
		left: 1em;
	}
	#debug::after {
		content: " Show Debug";
		margin-left: 1.5em;
		white-space: nowrap;
	}
	#debug:checked + main .debugwrapper {
		display: block;
		line-height: 0;
		outline: 1px solid lime;
	}

	/** NON ESSENTIAL STYLES BELOW **/

	html,
	body {
		margin: 0;
		padding: 0;
		background: #fff;
	}

	body {
		font-size: clamp(1.1em, calc(0.5em + 1vw), 3em);
		line-height: 1.42;
		font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
			"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
			sans-serif;
	}

	main {
		font-weight: 300;
		width: 90vw;
		max-width: 40em;
		margin: 0 auto;
		padding: 4em 0;
	}

	img {
		height: 50vh;
		max-height: 10em;
		width: auto;
	}

	.text-center {
		text-align: center;
	}
}

              
            
!

JS

              
                
              
            
!
999px

Console