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="home panel blue">
<div>
<h1 class="title-home">HOME PANEL</h1>
<p class="text-home">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Magni repudiandae odit delectus illo dolore, corrupti provident, recusandae inventore nesciunt vero, modi non temporibus quaerat cum. Distinctio corrupti esse harum eos blanditiis, illo nostrum sapiente hic tempore. Doloribus quidem beatae et laborum! Iusto quasi quas, alias, est nihil magnam aspernatur accusamus aut ullam, ut eaque iste porro officia ex fugiat pariatur dolor vitae eligendi nobis rem. Quisquam nisi tempora laborum, odit ullam eos, laudantium necessitatibus nihil, aliquid ducimus id minus est incidunt. Quo eveniet ratione in fugit reprehenderit. Praesentium facilis quis deleniti optio incidunt voluptate ipsum eligendi beatae! Ex et quasi pariatur natus sit, odit magnam quaerat suscipit deserunt libero.</p>
<div class="arrow"></div>
</div>
</div> -->
<div id="container">
<section class="panel red">
<h1 class="title-1">PANEL ONE</h1>
<p class="text-1">Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid, ullam. Doloremque soluta fugiat ipsum similique, ipsa nobis temporibus sunt iste. Voluptate et neque, porro, dolorem dicta nobis laborum quidem nostrum voluptatem quae maxime consequatur placeat dolore ullam nihil doloribus asperiores eos dolorum necessitatibus laudantium recusandae possimus? Commodi, consequuntur maiores possimus error minima sint vitae ipsam suscipit ad deserunt. Dolorem unde laboriosam mollitia perferendis quasi quae ad explicabo minus impedit omnis ab veritatis ullam alias ducimus labore nam animi quibusdam iure libero nisi aperiam, quam perspiciatis corporis tenetur. Eos voluptas iste, doloribus quisquam debitis ipsam? Explicabo numquam suscipit hic qui assumenda.</p>
<div class="big-text">BIG TEXT</div>
</section>
<section class="panel orange">
<h1 class="title-2">PANEL TWO</h1>
<div class="left-box">
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Animi libero cumque maxime tempora itaque ut explicabo vero dolorum, dicta accusantium. Nulla iusto perspiciatis saepe voluptatem quis ab similique eveniet neque beatae, obcaecati ipsam quo aliquam tempora quod ut ad excepturi quae doloremque.</p>
</div>
<div class="right-box">
<p>Amet numquam incidunt fuga quisquam doloribus excepturi, veritatis magnam error blanditiis. Ipsum, est! Hic, non eveniet consectetur minima qui reiciendis officiis totam ducimus aliquid inventore perferendis vitae quibusdam quasi ad debitis dolorem vero eaque, consequatur distinctio pariatur expedita commodi dolor.</p>
</div>
</section>
<section class="panel purple">
<h1>PANEL THREE</h1>
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Animi libero cumque maxime tempora itaque ut explicabo vero dolorum, dicta accusantium. Nulla iusto perspiciatis saepe voluptatem quis ab similique eveniet neque beatae, obcaecati ipsam quo aliquam tempora quod ut ad excepturi quae doloremque, optio repellat? Amet numquam incidunt fuga quisquam doloribus excepturi, veritatis magnam error blanditiis. Ipsum, est! Hic, non eveniet consectetur minima qui reiciendis officiis totam ducimus aliquid inventore perferendis vitae quibusdam quasi ad debitis dolorem vero eaque, consequatur distinctio pariatur expedita commodi dolor. Illum, a perferendis. Alias debitis facilis deleniti mollitia in ipsum accusantium voluptatem esse. Facilis, repellat quas.</p>
</section>
<section class="panel green">
<h1>PANEL FOUR</h1>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Maiores, omnis! Corrupti, voluptatum tempore! Magni, veritatis veniam vitae sed quam facilis architecto reprehenderit, delectus alias, corporis tenetur. Officia, blanditiis pariatur eius quos quaerat alias autem optio illo quasi temporibus atque amet, praesentium dicta beatae deserunt omnis. Autem obcaecati pariatur eius molestias minima reiciendis voluptatem distinctio sunt. Aliquid provident aut reiciendis quia, qui cupiditate earum asperiores ipsam in id ut labore et minima architecto suscipit unde vel numquam atque sequi. Aspernatur a quidem eum modi, corporis et animi distinctio eligendi in ratione velit facere numquam. Quaerat iste earum similique beatae eaque provident.</p>
</section>
<section class="panel grey">
<h1>PANEL FIVE</h1>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Maiores, omnis! Corrupti, voluptatum tempore! Magni, veritatis veniam vitae sed quam facilis architecto reprehenderit, delectus alias, corporis tenetur. Officia, blanditiis pariatur eius quos quaerat alias autem optio illo quasi temporibus atque amet, praesentium dicta beatae deserunt omnis. Autem obcaecati pariatur eius molestias minima reiciendis voluptatem distinctio sunt. Aliquid provident aut reiciendis quia, qui cupiditate earum asperiores ipsam in id ut labore et minima architecto suscipit unde vel numquam atque sequi. Aspernatur a quidem eum modi, corporis et animi distinctio eligendi in ratione velit facere numquam. Quaerat iste earum similique beatae eaque provident.</p>
</section>
</div>
<div class="panel blue">
<div>
<h1>VERTICAL PANEL</h1>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dicta eum facere consequuntur quas modi animi iure inventore quia repellendus? Fuga aliquid error nostrum, sint mollitia architecto quisquam ipsa iste accusantium debitis vitae pariatur enim, deserunt iusto ex beatae commodi fugiat quas culpa tempore qui aperiam iure. Ab unde sequi repellat, dolorem commodi cum dolorum omnis repudiandae, et laborum itaque sunt a placeat! Adipisci veniam architecto tenetur veritatis accusamus nesciunt tempore! Nihil animi veniam incidunt quaerat, sequi perferendis debitis tenetur odio veritatis. Nihil ratione nam delectus at, iusto, ad praesentium adipisci quidem repellat explicabo blanditiis excepturi voluptatum consequatur quam officiis veniam.</p>
</div>
</div>
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500;800;900&display=swap");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
margin: 0;
height: 100vh;
font-size: 10px;
-webkit-overflow-scrolling: touch;
font-family: "Montserrat", sans-serif;
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
body::-webkit-scrollbar {
display: none; /* Chrome, Safari and Opera */
}
#container {
width: 100%;
height: 100%;
overflow: hidden;
}
.panel {
position: absolute;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-weight: 600;
font-size: 1.6rem;
text-align: center;
color: white;
padding: 1rem;
}
/* style panels and panel content */
h1,
h2,
p,
li {
max-width: 800px;
}
.panel h1 {
font-size: 6rem;
color: black;
font-weight: 300;
margin-bottom: 5rem;
}
.panel p,
.panel li {
color: black;
font-weight: 400;
text-align: left;
line-height: 2;
margin-bottom: 5rem;
}
.panel.home {
position: relative;
}
.panel.orange {
flex-direction: row;
}
/* panel colours */
.blue {
background-color: #2c7ad2;
}
.orange {
background-color: #e77614;
}
.red {
background-color: #c82736;
}
.purple {
background-color: #8d3dae;
}
.green {
background-color: #28a92b;
}
.grey {
background-color: #555555;
}
/* text animations */
.title-home,
.text-home {
opacity: 0;
}
.panel .title-1,
.panel .text-1 {
opacity: 0;
}
.panel .big-text {
position: absolute;
font-size: 150px;
top: 25%;
opacity: 0;
}
.title-2 {
position: absolute;
top: 5rem;
}
.left-box,
.right-box {
margin: 2rem;
padding: 20px;
width: 30%;
height: 50%;
background-color: darkorange;
opacity: 0.3;
}
/* boring stuff */
.arrow {
position: relative;
top: 10px;
margin: 0 auto;
width: 40px;
height: 40px;
background-image: url(../img/pngegg.png);
background-size: contain;
font-size: 12px;
font-weight: 400;
}
gsap.registerPlugin(ScrollTrigger);
gsap.defaults({ ease: "none", duration: 2 });
// home panel title and text fade-in
gsap.to(".title-home", { opacity: 1, duration: 0.5 });
gsap.to(".text-home", { opacity: 1, duration: 0.5 }).delay(0.5);
// create a sequence that moves 3 of the panels in from different directions
const tl = gsap.timeline({
// scrollTrigger: {
// trigger: "#container",
// start: "top top",
// end: "+=5000",
// scrub: 1,
// markers: true,
// pin: true,
// anticipatePin: 1,
// snap: {
// snapTo: "labels" // snap to the closest label in the timeline
// }
// }
});
tl.addLabel("one")
.to(".title-1", { opacity: 1, duration: 1 })
.to(".text-1", { opacity: 1, duration: 1 })
.fromTo(".big-text", { left: 0 }, { right: 0, duration: 3, opacity: 0.5 })
.from(".orange", { xPercent: -100 })
.from(".left-box", { opacity: 0, duration: 1 })
.from(".right-box", { opacity: 0, duration: 1 })
.addLabel("two")
.from(".purple", { xPercent: 100 })
.addLabel("three")
.from(".green", { yPercent: -100 })
.addLabel("four")
.from(".grey", { xPercent: 100 })
.addLabel("five");
Also see: Tab Triggers