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 id="background-container">
<div class="section">
<div id="icon-1">
<svg viewBox="0 0 500 500" height="100px" width="100px" xmlns="http://www.w3.org/2000/svg">
<circle class="yellow-stroke" cx="250" cy="250" r="248"></circle>
<circle class="yellow-stroke" cx="362.81" cy="248.5" r="124.25"></circle>
<circle class="yellow-stroke" cx="415" cy="248.5" r="62.13"></circle>
</svg>
</div>
<div class="text">
<h2>I'm the first title</h2>
<p>And here's some paragraph text about this section.</p>
</div>
</div>
<div class="section">
<div id="icon-2">
<svg viewBox="0 0 650 650" xmlns="http://www.w3.org/2000/svg" height="130px" width="130px">
<path id="motionPath" class="yellow-stroke" d="M 570 325 C 570 460.31 460.31 570 325 570 C 189.69 570 80 460.31 80 325 C 80 189.69 189.69 80 325 80 C 460.31 80 570 189.69 570 325 Z" transform="matrix(0.731353, -0.681999, 0.681999, 0.731353, -134.339434, 308.959923)"></path>
<circle class="pale-fill" cx="500" cy="150" r="75"></circle>
</svg>
</div>
<div class="text">
<h2>I'm the second title</h2>
<p>And here's some paragraph text about this section.</p>
</div>
</div>
<div class="section">
<div id="icon-3">
<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg" height="100px" width="100px">
<circle class="pale-stroke" cx="250" cy="250" r="247.5"></circle>
<path class="yellow-stroke dash-stroke" d="M 375 250 C 375 319.04 319.04 375 250 375 C 84.19 368.42 84.24 131.56 250 125 C 319.03 125 375 180.96 375 250 Z"></path>
</svg>
<circle class="pale-fill" cx="428.06" cy="74.64" r="62.5"></circle>
</svg>
</div>
<div class="text">
<h2>I'm the third title</h2>
<p>And here's some paragraph text about this section.</p>
</div>
</div>
<div class="section">
<div id="icon-4">
<svg viewBox="0 0 750 750" xmlns="http://www.w3.org/2000/svg" height="150px" width="150px">
<path class="yellow-stroke dash-stroke" d="M 625 375.01 C 625 513.44 512.79 625.67 374.35 625.67 C 41.85 612.46 41.93 137.49 374.35 124.33 C 512.79 124.33 625 236.56 625 375.01 Z"></path>
<path class="teal-fill" d="M 399.32 4.9 C 399.32 4.9 399.27 4.87 399.25 4.87 C 391.8 1.72 383.6 0 375 0 C 340.52 0 312.5 28 312.5 62.5 C 312.5 87.83 327.62 109.63 349.3 119.47 C 349.32 119.47 349.33 119.47 349.37 119.5 C 357.17 123.03 365.87 125 375 125 C 409.47 125 437.5 96.97 437.5 62.5 C 437.5 36.62 421.73 14.4 399.32 4.92 L 399.32 4.9 Z M 375.03 90.12 C 370.65 90.12 366.52 89.12 362.78 87.3 C 353.6 82.82 347.22 73.38 347.22 62.5 C 347.22 47.02 359.73 34.67 375.03 34.67 C 378.62 34.67 382.07 35.37 385.23 36.58 C 385.27 36.62 385.27 36.62 385.28 36.63 C 395.55 40.7 402.83 50.68 402.83 62.48 C 402.83 77.77 390.32 90.12 375.03 90.12 Z"></path>
</svg>
</div>
<div class="text">
<h2>I'm the fourth title</h2>
<p>And here's some paragraph text about this section.</p>
</div>
</div>
<div class="section">
<div id="icon-5">
<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg" height="100px" width="100px">
<defs>
<mask id="theMask1">
<path id="maskPath1" d="M 498.75 250 C 498.75 387.38 387.08 498.75 249.34 498.75 C -81.49 485.64 -81.4 14.3 249.34 1.25 C 387.08 1.25 498.75 112.62 498.75 250 Z" fill="none" stroke="#fff" stroke-miterlimit="10" stroke-width="10" />
</mask>
<mask id="theMask2">
<path id="maskPath2" d="M 374.67 250 C 374.67 319.04 318.71 375 249.67 375 C 83.86 368.42 83.91 131.56 249.67 125 C 318.7 125 374.67 180.96 374.67 250 Z" fill="none" stroke="#fff" stroke-miterlimit="10" stroke-width="10" />
</mask>
<mask id="theMask3">
<path id="maskPath3" d="M 312.34 250 C 312.34 284.52 284.36 312.5 249.84 312.5 C 166.93 309.21 166.96 190.78 249.84 187.5 C 284.36 187.5 312.34 215.48 312.34 250 Z" fill="none" stroke="#fff" stroke-miterlimit="10" stroke-width="10" />
</mask>
</defs>
<g id="maskReveal1" mask="url(#theMask1)">
<path id="dashedPath1" class="yellow-stroke" d="M 498.75 250 C 498.75 387.38 387.08 498.75 249.34 498.75 C -81.49 485.64 -81.4 14.3 249.34 1.25 C 387.08 1.25 498.75 112.62 498.75 250 Z" />
</g>
<g id="maskReveal2" mask="url(#theMask2)">
<path id="dashedPath2" class="yellow-stroke" d="M 374.67 250 C 374.67 319.04 318.71 375 249.67 375 C 83.86 368.42 83.91 131.56 249.67 125 C 318.7 125 374.67 180.96 374.67 250 Z" />
</g>
<g id="maskReveal3" mask="url(#theMask3)">
<path id="dashedPath3" class="yellow-stroke" d="M 312.34 250 C 312.34 284.52 284.36 312.5 249.84 312.5 C 166.93 309.21 166.96 190.78 249.84 187.5 C 284.36 187.5 312.34 215.48 312.34 250 Z" />
</g>
</svg>
</div>
<div class="text">
<h2>I'm the fifth title</h2>
<p>And here's some paragraph text about this section.</p>
</div>
</div>
<div class="section">
<div id="icon-6">
<svg viewBox="0 0 650 650" xmlns="http://www.w3.org/2000/svg" height="130px" width="130px">
<path class="teal-fill" d="M 422.25 94.65 C 422.11 94.65 422.05 94.58 421.98 94.51 C 392.19 81.95 359.35 74.99 325.03 74.99 C 187.08 74.99 75 187.08 75 324.99 C 75 426.34 135.46 513.64 222.21 552.9 C 222.28 552.97 222.35 552.97 222.41 553.04 C 253.69 567.16 288.48 575 325.03 575 C 462.92 575 575 462.97 575 325 C 575 221.55 511.97 132.63 422.25 94.66 L 422.25 94.65 Z M 325.03 435.53 C 307.53 435.53 290.91 431.48 276.12 424.25 C 239.3 406.28 213.76 368.64 213.76 324.99 C 213.76 263.1 263.89 213.7 325.03 213.7 C 339.42 213.7 353.2 216.47 365.9 221.47 C 365.97 221.54 366.04 221.54 366.1 221.61 C 407.11 237.83 436.29 277.76 436.29 324.99 C 436.29 386.14 386.16 435.53 325.02 435.53 L 325.03 435.53 Z"></path>
<path class="yellow-stroke dash-stroke" d="M 647.5 325 C 647.5 358.83 620 386.25 586.08 386.25 C 504.63 383.03 504.66 266.96 586.08 263.75 C 620 263.75 647.5 291.17 647.5 325 Z"></path>
</svg>
</div>
<div class="text">
<h2>I'm the sixth title</h2>
<p>And here's some paragraph text about this section.</p>
</div>
</div>
<div class="section">
<div id="icon-7">
<svg viewBox="0 0 750 500" xmlns="http://www.w3.org/2000/svg" height="100px" width="150px">
<path class="pale-fill" d="M 347.25 19.66 C 347.11 19.66 347.05 19.59 346.98 19.52 C 317.19 6.96 284.35 0 250.03 0 C 112.08 0 0 112.09 0 250 C 0 351.35 60.46 438.65 147.21 477.91 C 147.28 477.98 147.35 477.98 147.41 478.05 C 178.69 492.17 213.48 500.01 250.03 500.01 C 387.92 500.01 500 387.98 500 250.01 C 500 146.56 436.97 57.64 347.25 19.67 L 347.25 19.66 Z M 250.03 360.54 C 232.53 360.54 215.91 356.49 201.12 349.26 C 164.3 331.29 138.76 293.65 138.76 250 C 138.76 188.11 188.89 138.71 250.03 138.71 C 264.42 138.71 278.2 141.48 290.9 146.48 C 290.97 146.55 291.04 146.55 291.1 146.62 C 332.11 162.84 361.29 202.77 361.29 250 C 361.29 311.15 311.16 360.54 250.02 360.54 L 250.03 360.54 Z"></path>
<path class="teal-stroke dash-stroke" d="M 750 250 C 750 388.08 637.77 500 499.34 500 C 166.84 486.83 166.93 13.12 499.34 0 C 637.77 0 750 111.93 750 250 Z"></path>
</svg>
</div>
<div class="text">
<h2>I'm the seventh title</h2>
<p>And here's some paragraph text about this section.</p>
</div>
</div>
</div>
.section svg {
overflow: visible;
}
#background-container {
background-color: #253746;
width: auto;
min-height: 100vh;
height: 100%;
padding: 50px;
color: #fff;
font-family: sans-serif;
}
.section {
width: 100%;
margin: 20px;
display: inline-block;
}
.text {
margin-top: 40px;
}
#icon-1 {
width: 100px;
}
#icon-2, #icon-6 {
margin: 0 0 -15px -15px;
}
#icon-4 {
margin: 0 0 -25px -25px;
}
.yellow-stroke, .pale-stroke, .teal-stroke {
fill: none;
stroke-miterlimit: 10;
stroke-width: 5px;
}
.dash-stroke {
stroke-dasharray: 0px, 5px, 10px, 1px;
stroke-width: 1.5px;
vector-effect: non-scaling-stroke;
}
.yellow-stroke {
stroke: #f1b434;
}
.pale-stroke {
stroke: #dde5ed;
}
.teal-stroke {
stroke: #00859b;
}
.pale-fill {
fill: #dde5ed;
}
.teal-fill {
fill: #00859b;
}
const t1 = gsap.timeline({scrollTrigger: {trigger: "#icon-1", toggleActions: "play pause play pause"}});
const t2 = gsap.timeline({defaults: {duration: 5, repeat: -1, yoyo: true, repeatDelay: 0.5, ease:"back.inOut"},ScrollTrigger: {trigger: "#icon-2", toggleActions: "play pause play pause"}});
const t3 = gsap.timeline({scrollTrigger: {trigger: "#icon-3", toggleActions: "play pause play pause"}});
const t4 = gsap.timeline({scrollTrigger: {trigger: "#icon-4", toggleActions: "play pause play pause"}});
const t5 = gsap.timeline({defaults: {duration: 1.5, ease: "none", transformOrigin: "50% 50%"},ScrollTrigger: {trigger: "#icon-5", toggleActions: "play pause play pause"}});
const t6 = gsap.timeline({scrollTrigger: {trigger: "#icon-6", toggleActions: "play pause play pause"}},{repeat: -1});
const t7 = gsap.timeline({scrollTrigger: {trigger: "#icon-7", toggleActions: "play pause play pause"}});
t1.to("#icon-1", {rotate: 360, transformOrigin: "50% 50%", repeat: -1, duration: 5, ease: "none"});
t2.from("#icon-2 .yellow-stroke", {drawSVG: 0})
.to("#icon-2 .pale-fill", {rotate: 360, svgOrigin: "325px 325px"}, "<");
t3.to("#icon-3 .dash-stroke", {duration: 5, rotate: 360, transformOrigin: "50% 50%", repeat: -1, ease: "expo.inOut"})
.to("#icon-3 .pale-stroke", {duration: 1, scale: 0.5, repeat: -1, yoyo: true, repeatDelay: 4}, "<");
t4.to("#icon-4 .teal-fill", {duration: 5, rotate: 360, svgOrigin: "375px 375px", repeat: -1, ease:"power4.inOut"});
t5.from("#icon-5 #maskPath1", {drawSVG: 0})
.to("#icon-5 #dashedPath1", {strokeDasharray: "30 11", stroke: "#dde5ed"}, "<")
.from("#icon-5 #maskPath2", {drawSVG: 0}, "-=0.6")
.to("#icon-5 #dashedPath2", {strokeDasharray: "30 11"}, "<")
.from("#icon-5 #maskPath3", {drawSVG: 0}, "-=0.6")
.to("#icon-5 #dashedPath3", {strokeDasharray: "30 11", stroke: "#dde5ed"}, "<")
.to("#icon-5 #dashedPath1", {duration: 5, rotate: 360, repeat: -1, ease: "expo.inOut"})
.to("#icon-5 #dashedPath3", {duration: 4, rotate: 360, repeat: -1, ease: "expo.inOut"}, "<")
.to("#icon-5 #dashedPath2", {duration: 3, rotate: -360, repeat: -1, ease: "expo.inOut"}, "<");
t6.to("#icon-6 .yellow-stroke", {x: -262.5, duration: 1})
.to("#icon-6 .yellow-stroke", {scale: 3, transformOrigin: "50% 50%", duration: 2}, "<")
.to("#icon-6 .yellow-stroke", {scale: 1, transformOrigin: "50% 50%", duration: 2})
.to("#icon-6 .yellow-stroke", {x: -525, duration: 1}, "-=1")
.to("#icon-6 .yellow-stroke", {rotate: 180, svgOrigin: "325px 325px", duration: 4, ease: "elastic"})
t7.to("#icon-7 .teal-stroke", {x: -250, repeat: -1, yoyo: true, duration: 4, ease: "back.inOut"})
.to("#icon-7 .pale-fill", {x: 250, repeat: -1, yoyo: true, duration: 4, ease: "back.inOut"}, "<")
.to("#icon-7 .teal-stroke", {duration: 4, rotate: -360, transformOrigin: "50% 50%", repeat: -1, yoyo: true, ease: "expo.inOut"}, "<")
Also see: Tab Triggers