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.
<svg width="100%" height="100%" viewBox="0 0 1028 664" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;">
<g id="design">
<path id="message" d="M561,79.99l0,96.02c0,4.962 4.033,8.99 9.006,8.99l15.916,0l12.422,13l12.422,-13l107.228,0c4.979,0 9.006,-4.023 9.006,-8.99l0,-96.02c0,-4.962 -4.033,-8.99 -9.006,-8.99l-147.988,0c-4.979,0 -9.006,4.023 -9.006,8.99Z" style="fill:#d8d8d8;fill-rule:nonzero;"/>
<g id="whatsapp">
<path id="whatsapp__phone" d="M930.043,427.97c-1.92,-0.968 -11.355,-5.648 -13.114,-6.294c-1.759,-0.646 -3.038,-0.968 -4.318,0.968c-1.279,1.936 -4.957,6.295 -6.076,7.586c-1.12,1.291 -2.239,1.453 -4.158,0.484c-1.919,-0.968 -8.103,-3.011 -15.433,-9.603c-5.705,-5.13 -9.557,-11.465 -10.676,-13.402c-1.119,-1.937 -0.119,-2.984 0.841,-3.948c0.864,-0.867 1.92,-2.26 2.879,-3.39c0.96,-1.129 1.279,-1.937 1.919,-3.227c0.64,-1.292 0.32,-2.421 -0.16,-3.39c-0.48,-0.968 -4.318,-10.491 -5.917,-14.365c-1.557,-3.772 -3.14,-3.261 -4.318,-3.321c-1.118,-0.056 -2.399,-0.068 -3.678,-0.068c-1.279,0 -3.358,0.484 -5.117,2.421c-1.759,1.936 -6.717,6.617 -6.717,16.139c0,9.524 6.876,18.723 7.836,20.014c0.96,1.292 13.532,20.833 32.784,29.213c4.578,1.993 8.153,3.184 10.94,4.075c4.597,1.473 8.781,1.265 12.088,0.767c3.687,-0.555 11.354,-4.68 12.953,-9.199c1.599,-4.52 1.599,-8.393 1.119,-9.2c-0.479,-0.807 -1.758,-1.291 -3.677,-2.26" style="fill:#e64;fill-rule:nonzero;"/>
<path id="whatsapp__bubble" d="M895.322,474.697l-0.026,0c-11.436,-0.005 -22.652,-3.082 -32.437,-8.899l-2.328,-1.383l-24.121,6.338l6.438,-23.558l-1.515,-2.415c-6.379,-10.164 -9.749,-21.911 -9.744,-33.974c0.014,-35.198 28.604,-63.834 63.758,-63.834c17.023,0.006 33.025,6.655 45.058,18.722c12.032,12.067 18.655,28.106 18.648,45.164c-0.014,35.2 -28.604,63.839 -63.731,63.839Zm-0.001,-140.697c-42.264,0 -76.661,34.453 -76.678,76.801c-0.006,13.537 3.525,26.75 10.235,38.399l-10.878,39.8l40.648,-10.68c11.2,6.118 23.81,9.344 36.643,9.348c42.291,0 76.692,-34.457 76.709,-76.805c0.008,-20.523 -7.961,-39.82 -22.437,-54.338c-14.477,-14.518 -33.729,-22.517 -54.242,-22.525Z" style="fill:#d8d8d8;fill-rule:nonzero;"/>
</g>
<g id="clock">
<circle id="clock__background" cx="272" cy="215" r="80" style="fill:#fff;stroke:#d8d8d8;stroke-width:14px;"/>
<path id="clock__minute" d="M272.406,150.902C273.724,151.009 274.084,151.148 274.776,151.424C277.291,152.426 279.162,154.874 279.456,157.58C279.495,157.939 279.49,158.03 279.5,158.391L279.5,214.01C279.343,219.82 271.432,223.803 266.842,219.455C265.562,218.243 264.734,216.57 264.544,214.821C264.505,214.462 264.51,214.371 264.5,214.01L264.5,158.391C264.541,156.894 264.702,156.444 265.033,155.615C266.035,153.1 268.483,151.229 271.189,150.935C271.972,150.85 272.156,150.895 272.406,150.902Z" style="fill:rgb(216,216,216);fill-rule:nonzero;"/>
<path id="clock__hour" d="M272.406,170.902C273.724,171.009 274.084,171.148 274.776,171.424C274.865,171.459 274.952,171.496 275.039,171.535C277.421,172.598 279.172,174.969 279.456,177.58C279.495,177.939 279.49,178.03 279.5,178.391L279.5,214.01C279.343,219.82 271.432,223.803 266.842,219.455C265.562,218.243 264.734,216.57 264.544,214.821C264.505,214.462 264.51,214.371 264.5,214.01L264.5,178.391C264.541,176.894 264.702,176.444 265.033,175.615C266.035,173.1 268.483,171.229 271.189,170.935C271.972,170.85 272.156,170.895 272.406,170.902Z" style="fill:rgb(238,102,68);fill-rule:nonzero;"/>
</g>
<g id="laptop">
<g id="laptop__base">
<path id="Shape" d="M218,574l600,0l0,10c0,5.523 -4.485,10 -10.007,10l-579.986,0c-5.527,0 -10.007,-4.476 -10.007,-10l0,-10Z" style="fill:#344;fill-rule:nonzero;"/>
<path id="Shape1" serif:id="Shape" d="M459,574l118,0l0,3c0,1.657 -1.346,3 -3.006,3l-111.988,0c-1.66,0 -3.006,-1.347 -3.006,-3l0,-3Z" style="fill:#495959;fill-rule:nonzero;"/>
</g>
<g id="laptop__screen">
<path id="laptop__screen__bezel" d="M260,267c0,-5.523 4.472,-10 9.999,-10l495.002,0c5.522,0 9.999,4.481 9.999,10l0,307l-515,0l0,-307Z" style="fill:#515e5e;fill-rule:nonzero;"/>
<rect id="laptop__screen__screen" x="290" y="287" width="455" height="256" style="fill:#fff;"/>
<circle id="laptop__screen__webcam" cx="523" cy="273" r="3" style="fill:#344;"/>
</g>
</g>
<g id="notification__second" class="notification">
<path id="notification__background" d="M728,378c0,-2.76 -2.24,-5 -5,-5l-223,0c-2.76,0 -5,2.24 -5,5l0,48c0,2.76 2.24,5 5,5l223,0c2.76,0 5,-2.24 5,-5l0,-48Z" style="fill:#d8d8d8;" />
<path id="notification__icon" d="M543.028,389.6c0,-2.76 -2.24,-5 -5,-5l-25,0c-2.76,0 -5,2.24 -5,5l0,25c0,2.76 2.24,5 5,5l25,0c2.76,0 5,-2.24 5,-5l0,-25Z" style="fill:#e64;" />
<path id="notification__second__text" d="M559.797,397.047c-2.093,0 -3.79,-1.763 -3.79,-3.938c0,-2.174 1.697,-3.937 3.79,-3.937l151.801,0c2.093,0 3.79,1.763 3.79,3.937c0,2.175 -1.697,3.938 -3.79,3.938l-151.801,0Zm-0.62,20.125c-2.093,0 -3.789,-1.763 -3.789,-3.938c0,-2.175 1.696,-3.938 3.789,-3.938l100.264,0c2.093,0 3.789,1.763 3.789,3.938c0,2.175 -1.696,3.938 -3.789,3.938l-100.264,0Z"
style="fill:#c5c5c5;fill-rule:nonzero;" />
</g>
<g id="notification__first" class="notification">
<path id="notification__background1" serif:id="notification__background" d="M728,310c0,-2.76 -2.24,-5 -5,-5l-223,0c-2.76,0 -5,2.24 -5,5l0,48c0,2.76 2.24,5 5,5l223,0c2.76,0 5,-2.24 5,-5l0,-48Z" style="fill:#d8d8d8;" />
<path id="notification__icon1" serif:id="notification__icon" d="M543.028,321.6c0,-2.76 -2.24,-5 -5,-5l-25,0c-2.76,0 -5,2.24 -5,5l0,25c0,2.76 2.24,5 5,5l25,0c2.76,0 5,-2.24 5,-5l0,-25Z" style="fill:#e64;" />
<path id="notification__text" d="M559.177,329.047c-2.093,0 -3.789,-1.763 -3.789,-3.938c0,-2.174 1.696,-3.937 3.789,-3.937l35.447,0c2.093,0 3.79,1.763 3.79,3.937c0,2.175 -1.697,3.938 -3.79,3.938l-35.447,0Zm53.17,0c-2.093,0 -3.789,-1.763 -3.789,-3.938c0,-2.174 1.696,-3.937 3.789,-3.937l99.251,0c2.093,0 3.79,1.763 3.79,3.937c0,2.175 -1.697,3.938 -3.79,3.938l-99.251,0Zm-53.17,20.125c-2.093,0 -3.789,-1.763 -3.789,-3.938c0,-2.175 1.696,-3.938 3.789,-3.938l100.264,0c2.093,0 3.789,1.763 3.789,3.938c0,2.175 -1.696,3.938 -3.789,3.938l-100.264,0Z"
style="fill:#c5c5c5;fill-rule:nonzero;" />
</g>
<g id="mail">
<path id="mail__background" d="M205,428.427c0,-3.002 2.442,-5.427 5.444,-5.427l122.112,0c3.002,0 5.444,2.43 5.444,5.427l0,94.146c0,3.002 -2.442,5.427 -5.444,5.427l-122.112,0c-3.002,0 -5.444,-2.43 -5.444,-5.427l0,-94.146Z" style="fill:#d8d8d8;fill-rule:nonzero;"/>
<path id="mail__shadow" d="M215.249,513.798l53.445,-37.579c2.133,-1.5 5.143,-1.492 7.266,0.018l52.841,37.579c4.322,3.074 1.884,9.283 -3.646,9.283l-106.286,0c-5.546,0 -7.974,-6.24 -3.62,-9.301Z" style="fill:#c5c5c5;fill-rule:nonzero;"/>
<path id="mail__lip" d="M324.519,431.065c1.734,-1.338 4.255,-1.055 5.631,0.632c1.375,1.688 1.085,4.141 -0.65,5.479l-54.678,42.2c-1.453,1.121 -3.506,1.127 -4.964,0.014l-55.305,-42.2c-1.742,-1.329 -2.047,-3.781 -0.681,-5.476c1.366,-1.695 3.885,-1.991 5.627,-0.662l52.818,40.302l52.202,-40.289Z" style="fill:#515e5e;fill-rule:nonzero;"/>
</g>
<g id="label">
<path id="label__background" d="M762,311c-21.539,0 -39,-17.461 -39,-39c0,-21.539 17.461,-39 39,-39c21.539,0 39,17.461 39,39c0,21.539 -17.461,39 -39,39Z" style="fill:#fff;fill-rule:nonzero;"/>
<circle id="label__alert" cx="762.5" cy="272.5" r="31.5" style="fill:#e64;"/>
</g>
</g>
</svg>
#mail,
.notification,
#message,
#clock,
#whatsapp,
#label {
opacity: 0;
}
// Timeline stuf
const tlMain = new TimelineMax({
// delay: 0.5,
repeat: 0,
repeatDelay: 2.5,
onComplete: () => console.warn('complete'),
});
const ringing = new TimelineMax({
// delay: 0.5,
repeat: -1,
repeatDelay: 2.5
});
const annoyingClock = new TimelineMax({
// delay: 0.5,
repeat: -1,
repeatDelay: 0
});
// Base ease full timeline
TweenLite.defaultEase = Back.easeOut.config(1.1);
const baseAnimate = 0.3;
//------------------------------------------------------//
// Nested animations
//------------------------------------------------------//
// Animate in timlines
function labelPop() {
const tl = new TimelineMax();
tl.set('#label', {opacity: 1, scale: 1, transformOrigin: "center"})
.fromTo('#label__background', baseAnimate, { scale: 0, transformOrigin: "center", ease: Expo.easeOut }, { scale: 1 }, "pop")
.fromTo('#label__alert', baseAnimate, { scale: 0, transformOrigin: "center" }, { scale: 1 }, "pop")
;
return tl;
}
function rotateIn(elm) {
const tl = new TimelineMax();
tl.fromTo(elm, baseAnimate*2, { y: 0, rotation: 180, transformOrigin:"bottom left" }, {opacity: 1, rotation: 0});
return tl;
}
function notificationIn(elm) {
const tl = new TimelineMax();
tl.fromTo(elm, baseAnimate, {opacity: 0, scaleX: 0, x: 50, transformOrigin:"top right" }, {opacity: 1, scaleX: 1, x: 0});
return tl;
}
function fadeInBottom(elm) {
const tl = new TimelineMax();
tl.fromTo(elm, baseAnimate*2, { y: 200 }, {opacity: 1, y: 0});
return tl;
}
// Animate out timlines
function fadeOutTop(elm) {
const tl = new TimelineMax();
tl.fromTo(elm, baseAnimate*2, { y: 0 }, {opacity: 0, y: -200});
return tl;
}
function scaleOut(elm) {
const tl = new TimelineMax();
tl.fromTo(elm, baseAnimate, { scale: 1 }, {opacity: 0, scale: 0});
return tl;
}
//------------------------------------------------------//
// END Nested animations
//------------------------------------------------------//
tlMain.fromTo('#laptop__screen', baseAnimate * 2, { scaleY: 0, transformOrigin: "bottom center" }, { scaleY: 1 })
.add(rotateIn('#message'), "+=1")
.add(rotateIn('#whatsapp'), "+=.5")
.add(notificationIn('#notification__first'), "+=.5")
.add(notificationIn('#notification__second'), "+=.2")
.add(labelPop(), "+=.2")
.add(fadeOutTop('#message'), "+=.2")
.add(fadeInBottom('#mail'), "+=.2")
.add(fadeInBottom('#clock'), "+=.2")
.add(scaleOut('#notification__second'), "+=.2")
.add(scaleOut('#notification__first'), "+=.2")
.add(scaleOut('#label'), "-=.2")
.add(fadeOutTop('#mail'), "+=.2")
.add(rotateIn('#message'), "+=.2")
.add(fadeInBottom('#mail'), "+=.2")
.add(notificationIn('#notification__first'), "+=.5") // ⚠️ This one doesnt work for some reason
.add(labelPop(), "+=.2") // ⚠️ This one doesnt work for some reason
;
ringing.fromTo('#whatsapp__phone', baseAnimate*3, { rotation: -20, transformOrigin:"center" }, {rotation: 0, ease: Elastic.easeOut.config( 1, 0.2), repeat:2});
annoyingClock
.fromTo('#clock__minute', 8, { rotation: 0, transformOrigin:"center 89%" }, {rotation: 12*360, ease: Linear.easeNone }, "clock")
.fromTo('#clock__hour', 8, { rotation: 0, transformOrigin:"center 88%" }, {rotation: 360, ease: Linear.easeNone }, "clock")
;
Also see: Tab Triggers