Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

Save Automatically?

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

              
                <div class="hero">Scroll Down</div>
<div class="banner">
	<div class="background miata"></div>
	<div class="foreground">
		<h1>1995 Mazda Miata</h1>
		<h2>10k miles</h2>
	</div>	
</div>
<div class="content">
	<p>Nullam lobortis tincidunt orci, id ultricies mauris consectetur sit amet. Nulla at enim augue. Nam quam velit, efficitur vestibulum justo iaculis, rutrum posuere sem. Orci varius natoque penatibus et magnis dis parturient montes</p>
	<p>Fusce at tincidunt felis. Etiam sit amet lectus viverra, porttitor tellus sit amet, fermentum elit. Phasellus sed neque tincidunt, ultrices ligula at, mattis elit. Fusce dictum ipsum metus, non convallis eros pulvinar in. Proin sit amet ultrices est. Aenean non quam lectus. Nullam ac mi risus. Suspendisse sed risus varius, vulputate urna in, rhoncus sem. Mauris nec sodales mi.
	</p>
 <p>Pellentesque ac nunc eget nisl tempor sagittis sit amet a ligula. Aliquam a blandit velit. Ut diam velit, sollicitudin ac ante id, finibus congue urna. Vestibulum malesuada non turpis in molestie. Etiam a ullamcorper lorem. Vestibulum a hendrerit libero.</p>
</div>


<div class="banner">
	<div class="background cayman"></div>
	<div class="foreground">
		<h1>2006 Porsche Cayman S</h1>
		<h2>33k miles</h2>
	</div>	
</div>
<div class="content">
	<p>Nullam lobortis tincidunt orci, id ultricies mauris consectetur sit amet. Nulla at enim augue. Nam quam velit, efficitur vestibulum justo iaculis, rutrum posuere sem. Orci varius natoque penatibus et magnis dis parturient montes</p>
	<p>Fusce at tincidunt felis. Etiam sit amet lectus viverra, porttitor tellus sit amet, fermentum elit. Phasellus sed neque tincidunt, ultrices ligula at, mattis elit. Fusce dictum ipsum metus, non convallis eros pulvinar in. Proin sit amet ultrices est. Aenean non quam lectus. Nullam ac mi risus. Suspendisse sed risus varius, vulputate urna in, rhoncus sem. Mauris nec sodales mi.
	</p>
 <p>Pellentesque ac nunc eget nisl tempor sagittis sit amet a ligula. Aliquam a blandit velit. Ut diam velit, sollicitudin ac ante id, finibus congue urna. Vestibulum malesuada non turpis in molestie. Etiam a ullamcorper lorem. Vestibulum a hendrerit libero.</p>
</div>

<div class="banner">
	<div class="background gti"></div>
	<div class="foreground">
		<h1>1983 VW Rabbit GTI</h1>
		<h2>253k miles</h2>
	</div>	
</div>
<div class="content">
	<p>Nullam lobortis tincidunt orci, id ultricies mauris consectetur sit amet. Nulla at enim augue. Nam quam velit, efficitur vestibulum justo iaculis, rutrum posuere sem. Orci varius natoque penatibus et magnis dis parturient montes</p>
	<p>Fusce at tincidunt felis. Etiam sit amet lectus viverra, porttitor tellus sit amet, fermentum elit. Phasellus sed neque tincidunt, ultrices ligula at, mattis elit. Fusce dictum ipsum metus, non convallis eros pulvinar in. Proin sit amet ultrices est. Aenean non quam lectus. Nullam ac mi risus. Suspendisse sed risus varius, vulputate urna in, rhoncus sem. Mauris nec sodales mi.
	</p>
 <p>Pellentesque ac nunc eget nisl tempor sagittis sit amet a ligula. Aliquam a blandit velit. Ut diam velit, sollicitudin ac ante id, finibus congue urna. Vestibulum malesuada non turpis in molestie. Etiam a ullamcorper lorem. Vestibulum a hendrerit libero.</p>
</div>


<div class="banner">
	<div class="background supra"></div>
	<div class="foreground">
		<h1>1994 Toyota Supra</h1>
		<h2>86k miles</h2>
	</div>	
</div>
<div class="content">
	<p>Nullam lobortis tincidunt orci, id ultricies mauris consectetur sit amet. Nulla at enim augue. Nam quam velit, efficitur vestibulum justo iaculis, rutrum posuere sem. Orci varius natoque penatibus et magnis dis parturient montes</p>
	<p>Fusce at tincidunt felis. Etiam sit amet lectus viverra, porttitor tellus sit amet, fermentum elit. Phasellus sed neque tincidunt, ultrices ligula at, mattis elit. Fusce dictum ipsum metus, non convallis eros pulvinar in. Proin sit amet ultrices est. Aenean non quam lectus. Nullam ac mi risus. Suspendisse sed risus varius, vulputate urna in, rhoncus sem. Mauris nec sodales mi.
	</p>
 <p>Pellentesque ac nunc eget nisl tempor sagittis sit amet a ligula. Aliquam a blandit velit. Ut diam velit, sollicitudin ac ante id, finibus congue urna. Vestibulum malesuada non turpis in molestie. Etiam a ullamcorper lorem. Vestibulum a hendrerit libero.</p>
</div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Barlow+Semi+Condensed:wght@700&display=swap');



* {
	position:relative;
}

body {
	font-family: 'Barlow Semi Condensed', sans-serif;
	color:white;
  	margin:0;
	background:#263238;
}

.banner {
	width:100vw;
	height:30vh;
	overflow:hidden;
	min-height:300px;
}


.background {
	filter:brightness(1);
	min-width:400px;
	width:100%;
	height:100%;
	
	background-size:100%;
	background-position:50%;
	background-repeat:no-repeat;
	position:absolute;
}

.miata {
	background-image: url("https://assets.codepen.io/32887/miata.jpg");
}

.gti {
	background-image: url("https://assets.codepen.io/32887/gti.jpg");
}

.cayman {
	background-image: url("https://assets.codepen.io/32887/caymans.jpeg");
}

.supra {
	background-image: url("https://assets.codepen.io/32887/supra.jpg");
}

.foreground {
	position:absolute;
	padding:25px;
}

h1, h2 {
	text-shadow:3px 3px 6px black;
	letter-spacing:1px;
}

.content {
	font-family:sans-serif;
	padding:50px;
	line-height:1.6em;
	font-size:1.3em;
	
}

.hero {
	width:100%;
	height:100vh;
	display:flex;
	align-items:center;
	justify-content:center;
	background:#ddd;
	color:#333;
	font-size:10vw;
}
              
            
!

JS

              
                console.clear()

let banners = document.querySelectorAll(".banner")

banners.forEach( (element) => {
	let background = element.querySelector(".background")
	let headings = element.querySelectorAll("h1, h2")
	
	
	let tl = gsap.timeline()
	   .from(background, {backgroundPosition:"60% 0%", filter:"brightness(0.1)", duration:1})
		.from(headings, {y:200, stagger:0.1}, 0)
	
	ScrollTrigger.create({
		trigger:element,
		start:"top 90%",
		toggleActions:"play none none reverse",
		animation:tl
	})
		
})

// master the art of GreenSock Animation
// https://www.creativeCodingClub.com

// unlock over 130 lessons designed to keep you out of the GreenSock Forums

              
            
!
999px

Console