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="container">
<section id="panel-1">
<p class="intro">Passer l'introduction</p>
<div class="top">
<h1><span class="first">B</span>IENVENUE</h1>
<svg class="line" viewBox="0 0 35 1" xmlns="http://www.w3.org/2000/svg">
<line x1="0" y1="0" x2="35" y2="0" stroke="black" />
</svg>
<div class="hider"></div>
</div>
<div class="bottom">
<img src="assets/egypt_example.png" alt="TODO">
<p>CodeTrotteurs vous emmène en voyage dans l’univers de la CSS...</p>
</div>
<div class="scroll">
<p>SCROLL</p>
<svg viewBox="0 0 24 24">
<path fill="currentColor" d="M10,4H14V13L17.5,9.5L19.92,11.92L12,19.84L4.08,11.92L6.5,9.5L10,13V4Z" />
</svg>
</div>
</section>
<section id="panel-2">
<div class="top">
<h2><span class="first">A</span>ccompagnez-nous et découvrez de nouvelles fonctionalités CSS à travers nos destinations favories.</h2>
<svg class="line" viewBox="0 0 1 60" xmlns="http://www.w3.org/2000/svg">
<line x1="0" y1="0" x2="0" y2="60" stroke="black" />
</svg>
</div>
<div class="bottom">
<img src="assets/egypt_example.png" alt="TODO">
<img src="assets/egypt_example.png" alt="TODO">
<img src="assets/egypt_example.png" alt="TODO">
<img src="assets/egypt_example.png" alt="TODO">
</div>
</section>
<section id="panel-3">
<div class="egypt right">
<img src="assets/pharaoh-face.png" alt="Une tête de Pharaon">
<div>
<h3>LE CAIRE</h3>
<svg class="line" viewBox="0 0 100 1" xmlns="http://www.w3.org/2000/svg">
<line x1="0" y1="0" x2="100" y2="0" />
</svg>
<p>Découvrez le mystère des Pyramides de Gizeh et émerveillez-vous devant
des paysages inédits qui vous plongeront au coeur de la mythologie égyptienne. </p>
</div>
</div>
<div class="japan left">
<div>
<h3>TOKYO</h3>
<svg class="line" viewBox="0 0 100 1" xmlns="http://www.w3.org/2000/svg">
<line x1="0" y1="0" x2="100" y2="0" />
</svg>
<p>Entre traditionnel et modernité, découvrez Tokyo et ses enseignes lumineuses,
ses temples ainsi que ses quartiers ultra technologiques.</p>
</div>
<img src="assets/tokyo-panel.png" alt="Affiche lumineuse pour café japonais">
</div>
<div class="norway right">
<img src="assets/egypt_example.png" alt="Une tête de Pharaon">
<div>
<h3>TRONDHEIM</h3>
<svg class="line" viewBox="0 0 100 1" xmlns="http://www.w3.org/2000/svg">
<line x1="0" y1="0" x2="100" y2="0" />
</svg>
<p>Berceau de la civilisation Viking, découvrez des paysages nordiques féeriques et admirez les aurores boréales.</p>
</div>
</div>
<div class="strasbourg left">
<div>
<h3>STRASBOURG</h3>
<svg class="line" viewBox="0 0 100 1" xmlns="http://www.w3.org/2000/svg">
<line x1="0" y1="0" x2="100" y2="0" />
</svg>
<p>Ville abritant le plus grand marché de Noël d’Europe, Strasbourg a un charme unique,
où les balades le long de l’Ill vous feront découvrir les traditions alsaciennes. </p>
</div>
<img src="assets/tokyo-panel.png" alt="Affiche lumineuse pour café japonais">
</div>
</section>
<section id="panel-4">
<div class="text">
<p><span class="dots">...</span> <span class="first">V</span>OTRE AVENTURE COMMENCE</p>
<p>MAINTENANT</p>
<svg class="line" viewBox="0 0 80 1" xmlns="http://www.w3.org/2000/svg">
<line x1="0" y1="0" x2="80" y2="0" />
</svg>
</div>
<div class="button-wrap">
<button>
Choisir ma destination
</button>
</div>
</section>
</div>
@font-face {
font-family: "TrajanPro";
src: url(../assets/fonts/Trajan-Pro-Regular.ttf);
}
@font-face {
font-family: "Teko";
src: url(../assets/fonts/Teko-Regular.ttf);
}
@font-face {
font-family: "Teko";
src: url(../assets/fonts/Teko-Bold.ttf);
font-weight: bold;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: #fff9f2;
font-family: Helvetica;
font-size: 18px;
}
.container {
height: 100vh;
width: 100vw;
position: relative;
overflow: hidden;
}
section {
position: absolute;
visibility: hidden;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
img {
display: block;
}
#panel-1 {
.line {
height: 3px;
position: relative;
top: -2em;
left: 1em;
z-index: 2;
}
.intro {
font-size: 0.8em;
position: absolute;
top: 1em;
right: 1em;
font-weight: 600;
cursor: pointer;
z-index: 2;
}
img {
height: 100%;
}
h1 {
font-size: 4em;
.first {
font-size: 3em;
margin-right: -5px;
}
}
.top {
height: 50%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
max-width: 1600px;
margin: auto;
padding: 0 5%;
position: relative;
}
.bottom {
height: 30%;
display: flex;
justify-content: space-evenly;
align-items: center;
max-width: 1600px;
margin: auto;
p {
font-size: 2em;
font-weight: bold;
width: 30%;
}
}
.scroll {
position: absolute;
font-size: 1.5em;
font-weight: bold;
text-align: center;
bottom: 0.5em;
left: 0;
right: 0;
svg {
width: 1em;
}
}
}
#panel-2 {
.top {
height: 50%;
max-width: 1450px;
margin: auto;
padding: 0 4%;
display: flex;
align-items: flex-end;
justify-content: flex-start;
font-size: 2.5em;
position: relative;
.first {
font-size: 2em;
line-height: 1em;
}
svg {
position: absolute;
left: 2%;
bottom: 1.5em;
width: 3px;
}
}
.bottom {
height: 50%;
max-width: 1450px;
margin: auto;
padding: 0 4%;
display: flex;
justify-content: space-between;
align-items: center;
img {
width: 20%;
height: 55%;
}
}
}
#panel-3 {
> div {
position: absolute;
width: 80%;
max-width: 1250px;
display: flex;
padding: 3em 0;
align-items: center;
height: 65%;
img {
width: 25%;
margin: 0 5%;
}
> div {
width: 60%;
max-width: 500px;
}
svg {
height: 2px;
position: relative;
top: -0.8em;
left: 0.5em;
}
h3 {
font-size: 3.5em;
font-weight: 400;
}
p {
font-size: 1.5em;
margin-top: 1em;
}
&.right {
right: 0;
border-radius: 30px 0 0 30px;
justify-content: flex-start;
}
&.left {
left: 0;
border-radius: 0 30px 30px 0;
justify-content: flex-end;
}
}
.egypt {
background-color: #233146;
top: 10%;
font-family: "TrajanPro";
img {
width: 30%;
margin: 0 2%;
}
> div {
width: 60%;
max-width: 500px;
}
svg {
stroke: #d97a4c;
}
h3 {
color: #d97a4c;
font-weight: 400;
}
p {
color: #ffcdb5;
}
}
.japan {
background-color: #371B31;
top: 14%;
font-family: "Teko";
color: white;
> div {
width: 60%;
max-width: 500px;
}
svg {
stroke: white;
top: -2em;
}
h3{
font-size: 5em;
font-weight: bold;
letter-spacing: .08em;
}
p{
font-size: 1.8em;
margin-top: .4em;
}
}
.norway{
background-color: #0E1E35;
top: 18%;
color: white;
svg{
stroke: white;
}
}
.strasbourg{
background-color: #8A453B;
top: 22%;
color: white;
svg{
stroke: white;
}
}
}
#panel-4{
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
.text{
height: 55%;
font-size: 3em;
font-weight: bold;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-end;
}
svg{
position: absolute;
height: 3px;
bottom: .1em;
right: .5em;
stroke: black;
}
.first{
font-size: 3em;
margin-right: -.14em;
}
.dots{
font-size: 1.5em;
}
.button-wrap{
height: 45%;
display: flex;
align-items: center;
justify-content: center;
}
button{
padding: .7em 1.2em;
background-color: grey;
font-size: 2em;
font-weight: bold;
border: none;
cursor: pointer;
}
}
(function () {
gsap.registerPlugin(GSDevTools, SplitText);
const wip = ["#panel-1", "#panel-2", "#panel-3"]
gsap.set(".norway, .strasbourg", { visibility: "hidden" });
const d = .5
const panel2Text = new SplitText("#panel-2 h2", { type: "words" });
const caireTitle = new SplitText(".egypt h3", { type: "chars" });
const caireText = new SplitText(".egypt p", { type: "lines" });
const tokyoText = new SplitText(".japan p", { type: "chars, lines" });
const initTl = gsap.timeline()
.set(wip, { autoAlpha: 1 })
.from("#panel-1 .line", { scaleX: 0, transformOrigin: "left", duration: d })
.from("#panel-1 h1", { x: -30, opacity: 0, duration: d * 1.5 }, "<" + d / 3)
.from("#panel-1 img", { y: -30, opacity: 0, duration: d * 1.5 }, "<" + d / 3)
.from("#panel-1 .bottom p", { y: 30, opacity: 0, duration: d * 1.5 }, "<" + d / 3)
.from("#panel-1 .scroll, #panel-1 .intro", { opacity: 0, duration: d * 2.5 }, "<" + d / 3)
const tl = gsap.timeline()
.addLabel("Start")
.to("#panel-1", { scale: .95, opacity: 0, duration: d })
.from("#panel-2 .line", { scaleY: 0, transformOrigin: "top", duration: d * 1.5 }, ">-" + d / 3)
.from(panel2Text.words, { y: gsap.utils.wrap([-20, 20]), opacity: 0, duration: d, stagger: d / 6 }, "<" + d / 3)
.from("#panel-2 img", { opacity: 0, stagger: d / 2, duration: d * 1.5 }, "<" + d * 2)
.addLabel("Panel 2")
.to("#panel-2 .top", { x: 70, opacity: 0, duration: d * 1.5 })
.to("#panel-2 .bottom", { x: -70, opacity: 0, duration: d * 1.5 }, "<")
.from(".egypt", { opacity: 0, xPercent: 101, duration: d * 1.5 }, ">-" + d * 0.8)
.from(".egypt img", { opacity: 0, duration: d * 1.5 }, "<" + d / 2)
.from(".egypt .line", { transformOrigin: "left", scaleX: 0 }, "<" + d / 2)
.from(caireTitle.chars, { y: -5, opacity: 0, stagger: { amount: d }, duration: d / 2 }, "<" + d / 4)
.from(caireText.lines, { opacity: 0, duration: d * 4, stagger: { amount: d } }, "<" + d / 2)
.addLabel("Le Caire")
.to(".egypt", { xPercent: 101, opacity: 0, duration: d * 2 })
.from(".japan", { xPercent: -101, opacity: 0, duration: d * 1.5 }, "<" + d*.75)
.from(".japan img", { opacity: 0, duration: d * 1.5 }, "<" + d / 2)
.from(".japan .line", { transformOrigin: "left", scaleX: 0 }, "<" + d / 2)
.from(".japan h3", {opacity: 0, duration: d*2}, "<" + d/2)
.from(tokyoText.chars, {opacity: 0, duration: d, stagger: {amount: d*2, from: "random"}}, "<" + d/2)
.addLabel("Tokyo")
.to(".egypt", { xPercent: 101, opacity: 0, duration: d * 2 })
.from(".japan", { xPercent: -101, opacity: 0, duration: d * 1.5 }, "<" + d*.75)
const master = gsap.timeline()
.add(initTl)
.add(tl);
GSDevTools.create();
})();
Also see: Tab Triggers