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 esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM 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="cInnerContent">
<h1 class="header-section gs_reveal ipsType_center">Chat with friends!</h1>
<div class="features">
<div class="feature ipsSpacer_bottom_double ipsGrid ipsGrid_collapsePhone">
<div class="featured-image-container ipsGrid_span5 gs_reveal gs_reveal_fromLeft">
<div class="card">
<img width="479" src="https://picsum.photos/479/479?index=1" alt="">
</div>
</div>
<div class="ipsGrid_span7 ipsType_left">
<h2 class="heading_large gs_reveal">Create amazing <strong>SVG</strong> animations</h2>
<p class="gs_reveal"><a href="https://greensock.com/drawsvg/">DrawSVGPlugin</a> allows you to progressively reveal (or hide) SVG strokes to make them look like they're being drawn. <a href="https://greensock.com/morphsvg/">MorphSVGPlugin</a> to Morph any SVG shape into any other shape smoothly regardless of the number of points in each. <a href="/docs/v3/Plugins/MotionPathPlugin">MotionPathPlugin</a> allows you to easily move any object along a path.</p>
</div>
</div>
<div class="feature ipsSpacer_bottom_double ipsGrid ipsGrid_collapsePhone">
<div class="ipsGrid_span7 ipsType_right">
<h2 class="heading_large gs_reveal">Supercharge immersive <strong>WebGL</strong> experiences</h2>
<p class="gs_reveal">GreenSock is used in some of the most popular <a href="//threejs.org/">Three.js</a> powered WebGL projects. Animate any object in a scene. <a href="https://greensock.com/PixiPlugin/">PixiPlugin</a> makes animating <a href="//www.pixijs.com/">Pixi.js</a> objects with GSAP a breeze. Animate position, scale, color effects and more with all the power and control of GSAP and the rendering speed of Pixi.js.</p>
</div>
<div class="featured-image-container ipsGrid_span5 gs_reveal gs_reveal_fromRight">
<div class="card">
<img width="479" src="https://picsum.photos/479/479?index=2" alt="">
</div>
</div>
</div>
<div class="feature ipsSpacer_bottom_double ipsGrid ipsGrid_collapsePhone">
<div class="featured-image-container ipsGrid_span5 gs_reveal gs_reveal_fromLeft">
<div class="card">
<img width="479" src="https://picsum.photos/479/479?index=3" alt="">
</div>
</div>
<div class="ipsGrid_span7 ipsType_left">
<h2 class="heading_large gs_reveal">Control performant <strong>Canvas</strong> animations</h2>
<p class="gs_reveal">GSAP makes animating with Canvas even easier by providing an easier way to look and sequence animations. GSAP works great with <a href="//www.adobe.com/products/animate.html">Adobe Animate</a> and <a href="//createjs.com/easeljs">EaseJS</a> through GSAP's <a href="https://greensock.com/easelplugin/">EaselJSPlugin</a>.</p>
</div>
</div>
<div class="feature ipsSpacer_bottom_double ipsGrid ipsGrid_collapsePhone">
<div class="ipsGrid_span7 ipsType_right">
<h2 class="heading_large gs_reveal"><strong>Award winning</strong> websites</h2>
<p class="gs_reveal">GSAP is used on over 8,500,000 sites and over 1,000 sites featured on <a href="https://www.awwwards.com/websites/gsap-animation/" target="_blank">Awwwards</a>. For some of our favorites, check out <a href="https://greensock.com/showcase/">our showcase</a>.</p>
</div>
<div class="featured-image-container ipsGrid_span5 gs_reveal gs_reveal_fromRight">
<div class="card">
<img width="479" src="https://picsum.photos/479/479?index=4" alt="">
</div>
</div>
</div>
</div>
</div>
/* Styles from the GreenSock website */
body {
font-weight: 300;
}
.ipsType_right {
text-align: right;
}
.ipsType_center {
text-align: center;
}
.cInnerContent {
max-width: 1240px;
margin-left: auto;
margin-right: auto;
}
.ipsSpacer_bottom_double {
margin-bottom: 30px;
}
.ipsGrid {
display: inline-block;
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
}
.ipsGrid::before, .ipsGrid::after {
display: table;
content: "";
line-height: 0;
}
.ipsGrid > [class*="ipsGrid_span"] {
display: block;
width: 100%;
min-height: 30px;
box-sizing: border-box;
}
.ipsGrid > .ipsGrid_span5 {
width: 40.42553191489362%;
}
.ipsGrid > .ipsGrid_span7 {
width: 57.44680851063829%;
}
.ipsGrid > [class*="ipsGrid_span"] {
float: left;
margin-left: 2%;
}
.ipsGrid > [class*="ipsGrid_span"]:first-child {
margin-left: 0;
}
.feature {
display: flex;
align-items: center;
}
.card {
margin-bottom: 30px;
border: 1px solid #cccccc;
border-radius: 8px;
overflow: hidden;
background: #ffffff;
box-shadow: 1px 1px 5px 1px #CCCCCC;
/* transition: 0.3s; */
}
.featured-image-container .card {
padding: 10px;
height: 0;
padding-bottom: calc(100% - 10px);
}
h2.heading_large {
font-size: 1.8em;
}
img {
max-width: 100%;
}
.header-section {
margin: 200px auto;
}
.gs_reveal {
opacity: 0;
visibility: hidden;
will-change: transform, opacity;
}
function animateFrom(elem, direction) {
direction = direction || 1;
var x = 0,
y = direction * 100;
if(elem.classList.contains("gs_reveal_fromLeft")) {
x = -100;
y = 0;
} else if (elem.classList.contains("gs_reveal_fromRight")) {
x = 100;
y = 0;
}
elem.style.transform = "translate(" + x + "px, " + y + "px)";
elem.style.opacity = "0";
gsap.fromTo(elem, {x: x, y: y, autoAlpha: 0}, {
duration: 1.25,
x: 0,
y: 0,
autoAlpha: 1,
ease: "expo",
overwrite: "auto"
});
}
function hide(elem) {
gsap.set(elem, {autoAlpha: 0});
}
document.addEventListener("DOMContentLoaded", function() {
gsap.registerPlugin(ScrollTrigger);
gsap.utils.toArray(".gs_reveal").forEach(function(elem) {
hide(elem); // assure that the element is hidden when scrolled into view
ScrollTrigger.create({
trigger: elem,
markers: true,
onEnter: function() { animateFrom(elem) },
onEnterBack: function() { animateFrom(elem, -1) },
onLeave: function() { hide(elem) } // assure that the element is hidden when scrolled into view
});
});
});
// 💚 This just adds the GSAP link to this pen, don't copy this bit
import { GSAPInfoBar } from "https://codepen.io/GreenSock/pen/vYqpyLg.js"
new GSAPInfoBar({ link: "https://gsap.com/docs/v3/Plugins/ScrollTrigger/"});
// 💚 Happy tweening!
Also see: Tab Triggers