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 URL's 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 it's URL and the proper URL extention.
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="wrapper">
<svg id="charly" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 151 207" width="150.428" height="206.518">
<g id="layer1" stroke="#000" stroke-linejoin="round">
<g id="zaehne" fill="#558d35" stroke-width="2" stroke-dashoffset="1.52" stroke-linecap="square" stroke-linejoin="round">
<path id="rect3009" d="M580.387 587.28h15.816v19.914h-15.816z" transform="matrix(1.00885 0 0 .88518 -463.3 -386.985)"/>
<path id="rect3009-4" d="M532.292 587.105h13.934v14.13h-13.934z" transform="matrix(1.00885 0 0 .88518 -463.3 -386.985)"/>
<path id="rect3009-8" d="M546.156 587.14h15.092v14.382h-15.092z" transform="matrix(1.00885 0 0 .88518 -463.3 -386.985)"/>
<path id="rect3009-82" d="M560.757 587.356h20.09v23.164h-20.09z" transform="matrix(1.00885 0 0 .88518 -463.3 -386.985)"/>
</g>
<path id="mundauf" fill="#f5e021" stroke-width="5" d="M24.52 202.81c1.302-41.545 4.28-83.092-.934-124.64-28.73-2.07-28.05-27.826 1.72-28.986C32.45 2.992 62.116 4.022 97.9 2.507c56.074 1.282 58.652 57.617 38.588 59.13h-23.123 7.302l23.91 55.405-83.804 16.673 36.122 14.95-1.785 55.363" stroke-linecap="round" stroke-linejoin="round"/>
<path id="mundzu" fill="#f5e021" stroke-width="5" d="M24.52 202.81c1.302-41.545 4.28-83.092-.934-124.64-28.73-2.07-28.05-27.826 1.72-28.986C32.45 2.992 62.116 4.022 97.9 2.507c56.074 1.282 58.652 57.617 38.588 59.13h-23.123 7.302l23.91 70.01-60.42.577H97.54l-2.435 71.804"/>
<g id="g3023" fill="#e18db8" stroke-dashoffset="1.52" stroke-linecap="square" stroke-linejoin="round">
<path id="path3766" stroke-width="2.92" d="M103.85 40.468c0 8.327-8.063 15.077-18.01 15.077-9.944 0-18.007-6.75-18.007-15.077S75.896 25.39 85.84 25.39c9.947 0 18.01 6.75 18.01 15.078z"/>
<path id="path3766-1" stroke-width="2" d="M88.972 39.812c0 1.7-1.648 3.08-3.68 3.08s-3.68-1.38-3.68-3.08c0-1.702 1.648-3.08 3.68-3.08s3.68 1.378 3.68 3.08z"/>
</g>
</g>
</svg>
<div id="text">
<h1>If you</h1>
<h1>scroll too fast,</h1>
<h1>you can not</h1>
<h1>read anything.</h1>
</div>
<div id="scroll">
<div id="scrollDistance"></div>
</div>
</div>
<main>
<h2>Anything else ...</h2>
<p class="fett">Freilebende Gummibärchen gibt es nicht. Man kauft sie in Packungen an der Kinokasse. Dieser Kauf ist der Beginn einer fast erotischen und sehr ambivalenten Beziehung Gummibärchen - Mensch. Zuerst genießt man. Dieser Genuß umfaßt alle Sinne. Man wühlt in den Gummibärchen, man fühlt sie. </p>
<p >Eine meiner Lieblingsphantasien, wo es um Gummibärchen geht, ist der Gummibär. Ich will einen riesigen Gummibären. Jeder wahre Gummibärchen-Gourmet wird mich verstehen. Ebenfall phantasieanregend können sie eingesetzt werden zum Aufbau verschiedener »Orgiengruppen- Modelle« oder als »Demonstrationsobjekt für wirbellose Tiere«. Abgesehen vom diabolischen Lustgewinn müßte man die Bärchen gar nicht zerreißen. Sie sind ja durchscheinend. Zu behaupten, daß sich im Gummibärchen das Wesen aller Dinge offenbart, finde ich keinesfalls als gewagt. Wer schon einmal über einem roten Gummibärchen meditiert hat, weiß von diesen Einsichten. Wenn ich das Kino verlasse oder die Packung einfach leergegessen ist, habe ich meist ein Gefühl, als hätte mir einer in den Magen getreten. Hier schläft die gesteigerte Intensität - als deren Ursache den Gummibärchen durchaus der Charakter einer Droge zuerkannt werden kann - ins Negative um, in den Überdruß. In dichter und geraffter Form spiegelt sich im Verhältnis zum Gummibärchen eine menschliche Love-Affair wider. Nie wieder Gummibärchen, denke ich jedesmal. In der Zwischenzeit lächle ich dann über den Absolutheitsanspruch den diese Momente erheben. Schon zu Hause beunruhigen mich wieder Gerüchte über einen Marktvorstoß der Japaner mit Gummireis oder Gummischweinen. Und wieder und wieder geht es mir durch den Kopf: Gummibärchen sind Spitze.</p>
</main>
body{
margin: 0;
background:grey;
}
#wrapper{
position: fixed;
height: 100vh;
width: 100%;
background: green;
overflow: hidden;
}
#charly{
position: absolute;
width: auto;
height: 70vh;
top: 70%;
left: -20%;
}
#scroll{
width: 114%;
height: 100%;
overflow-y: scroll;
position: absolute;
}
#scrollDistance{
width: 100%;
height: 4000px;
cursor: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/174563/scroll.png) , pointer;
}
main{
position: relative;
height: 2000px;
padding: 300px 50px 0 100px;
font-family: sans-serif;
visibility:hidden;
}
main p{
line-height: 1.5;
font-size: 16px;
max-width: 650px;
padding-left: 25px;
font-weight: 600;
}
#text{
position: absolute;
top: 60%;
left: 450px;
font-family: sans-serif;
font-size: 24px;
color: white;
}
#text h1{
position: absolute;
width: 400px;
visibility: hidden;
color: #afafaf;
}
TweenLite.set('#mundauf', {autoAlpha:0});
TweenMax.set("#charly, #text", {xPercent:-50, yPercent:-50});
TweenLite.set('#scrollDistance',{height:5000});
var charly = new TimelineMax({paused:true})
.to('#charly',3,{x:400, ease: Bounce.easeOut})
.to("#mundzu",1, {morphSVG:"#mundauf",repeat:11,yoyo:true},"label2")
.to("#zaehne",1, {rotation:-10, transformOrigin:"center top", y:-10, repeat:11, yoyo:true}, "label2")
.staggerTo('#text h1',0.2,{autoAlpha:1},3,"label2")
.staggerTo('#text h1',0.2,{autoAlpha:0},3,"label2+=3")
.to('#charly',1,{rotationY:40, transformOrigin:"center", repeat:1,yoyo:true},"label3")
.to('#charly',1,{scaleY:1.2, transformOrigin:"bottom"},"+=3")
.to('#charly',2,{x:2000, transformOrigin:"bottom"})
.to('#wrapper',0,{position:'relative'})
.to('body',0,{height:5000})
.to('#scrollDistance',0,{cursor:'auto'})
.to('main',0,{autoAlpha:1})
// === scrolling sync =========================
var lastScrollTop = 0;
$('#scroll').scroll(function(e) {
var scrollNum = $('#scroll').scrollTop();
scrollPercent = $('#scroll').scrollTop() / ($('#scrollDistance').height() - $('#scroll').height());
var progressCharly = scrollPercent*1;
if (scrollNum > lastScrollTop) { // downscroll
TweenLite.to(charly, 1, {progress:progressCharly, ease: Sine.easeOut});
} else { //upscroll
TweenLite.to(charly, 1, {progress:progressCharly, ease: Sine.easeOut});
}
lastScrollTop = scrollNum;
});
Also see: Tab Triggers