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.
<!-- Read about this on my blog
https://webanimation.blog/blog/getting-started-web-animation
-->
<div class="animation__blink--top blink--lid"></div>
<div class="animation__blink--bottom blink--lid"></div>
<main class="story">
<article class="story__container">
<h1 class="story__title">Tired</h1>
<div class="sleeping">
<!-- bron van wolken https://www.expeditiewadden.nl/ -->
<div class="story__cloud cloud1"></div>
<div class="story__cloud cloud2"></div>
<div class="story__cloud cloud3"></div>
</div>
<p class="story__body"><span class="wake-up">De buschauffeur port me wakker.</span> We zijn bij de eindhalte, Centraal Station. Ik stap uit en duw de kinderwagen voort waarin mijn zoon ligt te slapen. Ik wou dat ik hem was. De mensen lopen in zichzelf gekeerd over het plein. De regen doet z’n best mij wakker te houden, maar mijn oogleden voelen zwaar, alsof er een stel verveelde kaboutertjes aan lopen te trekken. Ik zou hier en nu op de grond kunnen liggen en gaan slapen. Maar ik loop door. Met loodzware benen. Richting de Openbare Bibliotheek. Om Stijloefeningen van Raymond Queneau te lenen. Ik zoek er al weken naar. Waarom eigenlijk? Ik had nu ook in bed kunnen liggen.</p>
<p class="story__body">Ik weet niet hoe lang ik al voor de bibliotheek sta als een vrouw mij aanspreekt. Ze heeft zwart krullend haar. Zou ik dromen? Ze vraagt iets aan me. Ik ben te moe om te horen wat. Ze praat in het Engels met een Frans accent. Je naisse quoi zeg ik. <span class="asleep">De vrouw kijkt me niet begrijpend aan en vraagt of dit het postkantoor is.</span></p>
<div class="sleeping">
<div class="story__cloud cloud1"></div>
<div class="story__cloud cloud2"></div>
<div class="story__cloud cloud3"></div>
</div>
<p class="cloud__story"><span class="wake-up">Ik moet heel lang en heel diep nadenken.</span> Halverwege vergeet ik de vraag. Ik kijk naar het gebouw.
De vrouw kijkt over haar schouder. Beneden rijdt een auto weg. Ik weet de vraag weer.
Het zou kunnen dat dit het postkantoor is. Het zou kunnen. Het zou ook niet kunnen. Ik weet niet zeker of ik dit denk of dat ik dit zeg.
</p>
<p class="story__body">
En ineens weet ik weer dat dit het postkantoor niet is, maar de bibliotheek. Het postkantoor was hier wel ooit. Nu kun je het beste naar de Raadhuisstraat gaan. Als ik mijn ogen opsla is de vrouw met het ravenzwarte haar verdwenen. Ze rent achter een achteruit rijdende auto aan. Binnen sta ik voor de Q. Ik lees de titels op de ruggen van de boeken, maar ze komen niet binnen. Mijn hersens weigeren dienst. Ze zijn te moe om te werken. <span class="asleep">Mijn ogen worden zwaarder en zwaarder.</span></p>
<div class="sleeping">
<div class="story__cloud cloud1"></div>
<div class="story__cloud cloud2"></div>
<div class="story__cloud cloud3"></div>
</div>
<p class="story__body">
<span class="wake-up">En dan ineens schrik ik op alsof iemand mij een schok geeft.</span> Stijloefeningen, dat was ik aan het zoeken. Ik loop de boeken met een Q langs. Maar niks. Ik ga achter de computer zitten en tik Stijloefeningen in. Ik dommel even in. Mijn oogleden blijven maar zwaarder en zwaarder worden. Ze vragen beleefd doch dwingend of ik even mijn hoofd te ruste wil brengen. Eventjes maar. Het hoeft niet lang. <span class="asleep">Mijn hoofd ligt op het toetsenbord. Kwijl sijpelt uit mijn rechtermondhoek.</span> </p>
<div class="sleeping">
<div class="story__cloud cloud1"></div>
<div class="story__cloud cloud2"></div>
<div class="story__cloud cloud3"></div>
</div>
<p class="story__body">
<span class="wake-up">Plots schrik ik wakker. </span>Op het scherm lees ik dat Stijloefeningen wel degelijk aanwezig is. Op de daartoe bestemde plank. Ik besluit een medewerker te vragen mee te zoeken. Want ik durf niet voor mezelf in te staan. De medewerker kan het boek ook niet vinden. Hij raadt me aan om een mail naar het magazijn te sturen. Daar hebben ze nog een exemplaar. <span class="asleep">Ik stuur een mail. Ik wacht en val in slaap.</span> </p>
<div class="sleeping">
<div class="story__cloud cloud1"></div>
<div class="story__cloud cloud2"></div>
<div class="story__cloud cloud3"></div>
</div>
<p class="story__body">
<span class="wake-up">Als ik wakker wordt is Spongebob bezig om met meneer</span> Krab een lading frituurvet te lozen. Mijn zoon zit als betoverd naar de tv te kijken, de beentjes voor zich uit, <span class="asleep">zijn hoofd in zijn nek.</span></p>
<div class="sleeping">
<div class="story__cloud cloud1"></div>
<div class="story__cloud cloud2"></div>
<div class="story__cloud cloud3"></div>
</div>
<p class="story__body"><span class="wake-up">Op het Bos en Lommerplein, vlakbij mijn huis,</span> koop ik babyschoentjes.</p>
<span class="last-sentence"> Ik wil slapen.</span>
</article>
</main>
$body-font: Helvetica Neue, Helvetica, Arial, sans-serif;
$title-link-font: 'Signika', -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
$blink-delay: 3s;
$blink-time: 12s;
body {
// Display & Box model
display: flex;
flex-flow: row wrap;
margin: 0 auto;
overflow-x: hidden;
// Text
font-family: $body-font;
font-weight: 400;
font-variants: common-ligatures;
font-feature-settings: "kern", "liga";
font-size: 16px;
font-size: 1em;
line-height: 1.5;
background-color: #fff;
animation: sleepyContent $blink-time ease-in infinite;
animation-delay: $blink-delay;
overflow-x: hidden;
}
h1, h2, h3 {
font-family: $title-link-font;
font-weight: 600;
font-size: 3rem;
}
.story {
font-size: 1.5em;
padding: 3rem;
text-align: left;
margin: 0 auto;
&__body {
max-width: 50rem;
margin: 0 auto;
}
}
.sleeping {
height: 80vh;
margin: 1em auto;
}
.cloud__story {
// margin-top: -75%;
max-width: 50rem;
margin: 0 auto 50%;
// font-size: 1.5em;
line-height: 1.75;
margin-bottom: 50%;
}
.asleep {
background: -webkit-linear-gradient(
top,
rgba(0, 0, 0, 1) 0%,
rgba(163, 163, 163, 0.5) 100%
);
background: linear-gradient(
to bottom,
rgba(0, 0, 0, 1) 0%,
rgba(163, 163, 163, 0.5) 100%
);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
display: inline-block;
margin: 0;
padding: 0;
}
.wake-up {
background: -webkit-linear-gradient(
left,
rgba(163, 163, 163, 0.5) 0%,
rgba(0, 0, 0, 1) 100%
);
background: linear-gradient(
to right,
rgba(163, 163, 163, 0.5) 0%,
rgba(0, 0, 0, 1) 100%
);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
display: inline-block;
margin: 0;
padding: 0;
}
.last-sentence {
font-family: "Signika";
display: block;
text-align: center;
font-size: 3em;
margin: 1em auto;
}
.story__cloud {
pointer-events: none;
}
.cloud1 {
background: url(https://meesrutten.me/images/cloud1.png) no-repeat;
background-size: 100%;
width: 20.625em;
height: 15em;
position: relative;
top: 10vh;
animation: clouds 25s linear infinite;
transform: translateZ(0) translateX(-50%);
left: 50%;
// margin-left: -300px;
// transition: .2s;
}
.cloud2 {
background: url(https://meesrutten.me/images/cloud2.png) no-repeat;
background-position: 50%;
background-size: 10.5em 6.875em;
width: 16.75em;
height: 15.625em;
position: relative;
top: -15vh;
transform: translateZ(0) translateX(-50%);
// right: 50%;
// margin-right: -400px;
animation: clouds 25s linear infinite;
transition: 0.2s;
}
.cloud3 {
background: url(https://meesrutten.me/images/cloud2.png) no-repeat;
background-position: 50%;
background-size: 12.5em 10em;
width: 18.75em;
height: 18.75em;
position: relative;
top: -25vh;
right: 10%;
transform: translateZ(0) translateX(-50%) rotateY(180deg);
// margin-right: -400px;
animation: reverseClouds 25s linear infinite;
// transition: .2s;
}
@keyframes clouds {
0% {
transform: translateX(-50%);
}
50% {
transform: translateX(0%);
}
100% {
transform: translateX(-50%);
}
}
@keyframes reverseClouds {
0% {
transform: translateX(50%);
}
50% {
transform: translateX(0%);
}
100% {
transform: translateX(50%);
}
}
.blink--lid {
width: 100vw;
height: 75vh;
position: fixed;
z-index: 1;
//scroll fix
pointer-events: none;
//gpu dirty hacks
transform: rotateZ(360deg) translateZ(0);
perspective: 1000px;
overflow: hidden;
background-color: #000;
background-image: -webkit-linear-gradient(
top,
#000 0%,
#333333 100%
); /* Chrome10-25,Safari5.1-6 */
background-image: linear-gradient(
to bottom,
#000 0%,
#333333 100%
); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
}
.animation__blink--top {
transform: translateY(-75vh);
animation: closeTopLid $blink-time ease-in infinite;
animation-delay: $blink-delay;
}
.animation__blink--bottom {
// bottom: 0;
transform: translateY(125vh);
background-image: -webkit-linear-gradient(
top,
#333333 0%,
#000 100%
); /* Chrome10-25,Safari5.1-6 */
background-image: linear-gradient(
to bottom,
#333333 0%,
#000 100%
); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
animation: closeBottomLid $blink-time ease-in infinite;
animation-delay: $blink-delay;
}
@keyframes closeTopLid {
0% {
transform: translateY(-75vh);
}
25% {
transform: translateY(-45vh);
animation-timing-function: ease-in-out;
}
30% {
transform: translateY(-55vh);
animation-timing-function: ease-in;
}
50% {
transform: translateY(-25vh);
}
55% {
transform: translateY(-25vh);
animation-timing-function: ease-out;
}
58% {
transform: translateY(-75vh);
}
100% {
transform: translateY(-75vh);
}
}
@keyframes closeBottomLid {
0% {
transform: translateY(100vh);
}
25% {
transform: translateY(70vh);
animation-timing-function: ease-in-out;
}
30% {
transform: translateY(80vh);
animation-timing-function: ease-in;
}
50% {
transform: translateY(50vh);
}
55% {
transform: translateY(50vh);
animation-timing-function: ease-out;
}
58% {
transform: translateY(100vh);
}
100% {
transform: translateY(100vh);
}
}
@keyframes sleepyContent {
0% {
color: rgba(0, 0, 0, 1);
text-shadow: 0 0 5px rgba(0, 0, 0, 0);
}
25% {
color: rgba(0, 0, 0, 1);
text-shadow: 0 0 5px rgba(0, 0, 0, 0);
}
50% {
color: rgba(0, 0, 0, 0);
text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}
65% {
color: rgba(0, 0, 0, 1);
text-shadow: 0 0 5px rgba(0, 0, 0, 0);
}
}
// background: url(../img/cloud2.png) no-repeat;
// background-position: 50%;
// background-size: 200px 160px;
// width: 300px;
// height: 300px;
// position: absolute;
// top: 200px;
// transform: translateZ(0) translateX(-50%) rotateY(180deg);
// right: 50%;
// margin-right: -400px;
// animation: e 30s linear infinite;
// transition: .2s;
Also see: Tab Triggers