HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<div class="heroWithAnimation">
<div class="container">
<div class="row justify-content-center">
<div class="col-12 col-md-10">
<div class="heroWithAnimation__header color--white text-center" data-animate="fadeIn">
</div>
<div class="heroWithAnimation__button" data-animate="fadeIn">
</div>
</div>
</div>
</div>
<div class="heroWithAnimation__overlay"></div>
<div class="heroWithAnimation__pattern">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 1600 400" style="enable-background:new 0 0 1600 400;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.6;fill:#FFFFFF;}
.st1{fill:#FFFFFF;}
.st2{opacity:0.7;fill:#FFFFFF;}
.st3{opacity:0.8;fill:#FFFFFF;}
.st4{opacity:0.4;fill:#FFFFFF;}
.st5{opacity:0.2;fill:#FFFFFF;}
.st6{opacity:0.3;fill:#FFFFFF;}
.st7{opacity:0.1;fill:#FFFFFF;}
.st8{fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFFF;}
</style>
<rect x="592.5" y="35.4" class="st5 high__rect--1" width="15.8" height="15.8"/>
<circle class="st7 high__circle--2" cx="669.9" cy="14" r="10.5"/>
<rect x="733.9" y="23.2" transform="matrix(0.7071 -0.7071 0.7071 0.7071 195.2609 533.6146)" class="st5 high__rect--3" width="15.8" height="15.8"/>
<rect x="816.7" y="49" class="st4 high__rect--4" width="15.8" height="15.8"/>
<circle class="st5 high__circle--5" cx="889.7" cy="10.5" r="10.5"/>
<rect x="951.4" y="20.6" class="st6 high__circle--6" width="15.8" height="15.8"/>
<rect x="1034.3" y="45.3" transform="matrix(0.7071 -0.7071 0.7071 0.7071 267.6085 752.5548)" class="st6 high__rect--7" width="15.8" height="15.8"/>
<circle class="st0 top__circle--5" cx="889.9" cy="91.2" r="17.9"/>
<rect x="808.8" y="121.8" class="st1 top__rect--4" width="31.6" height="31.6"/>
<rect x="584.6" y="118.6" class="st2 top__rect--1" width="31.6" height="31.6"/>
<rect x="943.5" y="96.5" class="st3 top__rect--6" width="31.6" height="31.6"/>
<rect x="1026.5" y="121.7" transform="matrix(0.7071 -0.7071 0.7071 0.7071 208.0598 777.2719)" class="st1 top__rect--7" width="31.6" height="31.6"/>
<rect x="725.8" y="104" transform="matrix(0.7071 -0.7071 0.7071 0.7071 132.5282 559.4997)" class="st2 top__rect--3" width="31.6" height="31.6"/>
<circle class="st4 top__circle--2" cx="669.8" cy="108.6" r="17.9"/>
<path class="st8" d="M840.4,153.4H872V185c0,9.9,8,17.9,17.9,17.9s17.9-8,17.9-17.9c0-4.7,1.9-9.3,5.2-12.6
c3.4-3.4,7.9-5.2,12.6-5.2c4.7,0,9.3,1.9,12.6,5.2s5.2,7.9,5.2,12.6v31.6h31.6V185l22.4-22.4l22.4,22.4l22.4,22.4l22.4-22.4h535.2
v215.1H0.2V185h539.7l22.4-22.4l22.4,22.4v31.6h31.6V185c0-4.7,1.9-9.3,5.2-12.6s7.9-5.2,12.6-5.2s9.3,1.9,12.6,5.2
c3.4,3.4,5.2,7.9,5.2,12.6c0,9.9,8,17.9,17.9,17.9c9.9,0,17.9-8,17.9-17.9v-31.6h31.6V185l22.4,22.4l44.7-44.7l22.4,22.4v31.6h31.6
V153.4z"/>
<rect x="981.7" y="225.4" transform="matrix(0.7071 -0.7071 0.7071 0.7071 121.6044 776.0109)" class="bottom__rect--7" width="31.6" height="31.6"/>
<rect x="770.7" y="251" transform="matrix(0.7071 -0.7071 0.7071 0.7071 41.6917 634.3301)" class="bottom__rect--3" width="31.6" height="31.6"/>
<rect x="546.4" y="231.7" mask="url(#image-mask)" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -10.3719 470.0517)" class="bottom__rect--1" width="31.6" height="31.6"/>
<rect x="687.7" y="223" class="bottom__rect--2" width="31.6" height="31.6"/>
<ellipse transform="matrix(0.6154 -0.7882 0.7882 0.6154 34.3411 602.0275)" class="bottom__circle--1" cx="634.1" cy="265.8" rx="17.9" ry="17.9"/>
<path class="bottom__circle--2" d="M907.8,263.6c0,9.9,8,17.9,17.9,17.9c9.9,0,17.9-8,17.9-17.9c0-9.9-8-17.9-17.9-17.9
C915.8,245.7,907.8,253.7,907.8,263.6z"/>
<rect x="840.3" y="217" class="bottom__rect--5" width="31.6" height="31.6"/>
</svg>
</div>
</div>
.heroWithAnimation{
height:50vh;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
position: relative;
background-attachment: fixed;
min-height: 500px;
padding-bottom:300px;
background:url('http://lorempixel.com/1024/768');
background-repeat:no-repeat;
background-size:cover;
background-position:top center;
color:#fff;
&__overlay{
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
z-index: 1;
background: rgba(0,0,0,0.6);
}
&__pattern {
position: absolute;
bottom: 0px;
width: 100%;
z-index: 100;
}
}
$(document).ready(function(){
var tlHighShapes = new TimelineMax();
tlHighShapes
.to(".high__rect--1", {duration: 1, y: 61, ease: Power0.easeOut, opacity:0},"<")
.to(".high__circle--2", {duration: 1.3, y: 84, ease: Power0.easeOut, opacity:0},"<")
.to(".high__rect--3", {duration: 1.3, y: 86, ease: Power0.easeOut, opacity:0},"<")
.to(".high__rect--4", {duration: 1.4, y: 90, ease: Power0.easeOut, opacity:0},"<")
.to(".high__circle--5", {duration: 1, y: 67, ease: Power0.easeOut, opacity:0},"<")
.to(".high__circle--6", {duration: 1.3, y: 80, ease: Power0.easeOut, opacity:0},"<")
.to(".high__rect--7", {duration: 1.4, y: 100, ease: Power0.easeOut, opacity:0},"<");
var tlBottomShapes = new TimelineMax();
tlBottomShapes
.to(".bottom__rect--7", {duration: 2, y: -41, ease: Power0.easeOut},"<")
.to(".bottom__rect--5", {duration: 2.3, y: -64, ease: Power0.easeOut},"<")
.to(".bottom__rect--3", {duration: 2.3, y: -66, ease: Power0.easeOut},"<")
.to(".bottom__rect--2", {duration: 2.4, y: -70, ease: Power0.easeOut},"<")
.to(".bottom__rect--1", {duration: 2, y: -47, ease: Power0.easeOut},"<")
.to(".bottom__circle--1", {duration: 2.3, y: -60, ease: Power0.easeOut},"<")
.to(".bottom__circle--2", {duration: 2.4, y: -80, ease: Power0.easeOut},"<");
var tlTopShapes = new TimelineMax();
tlTopShapes
.to(".top__rect--1", {duration: 1, y: 67, opacity:1},"<")
.to(".top__circle--2", {duration: 1, y: 77, opacity:1},"<")
.to(".top__rect--3", {duration: 1, y: 81, opacity:1},"<")
.to(".top__rect--4", {duration: 1, y: 63, opacity:1},"<")
.to(".top__circle--5", {duration: 1, y: 94, opacity:1},"<")
.to(".top__rect--6", {duration: 1, y: 88, opacity:1},"<")
.to(".top__rect--7", {duration: 1, y: 63, opacity:1},"<");
stHighShapes = ScrollTrigger.create({
trigger: ".heroWithAnimation__pattern",
start: "top center",
end: "+=50",
scrub: true,
animation: tlHighShapes
});
stBottom = ScrollTrigger.create({
trigger: ".heroWithAnimation__pattern",
start: "top center",
end: "+=100",
scrub: true,
animation: tlBottomShapes
});
stTop = ScrollTrigger.create({
trigger: ".heroWithAnimation__pattern",
start: "top center",
end: "+=100",
scrub: true,
animation: tlTopShapes
});
});
Also see: Tab Triggers