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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.
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.
If the stylesheet 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 CSS 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.
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.
<svg xmlns="http://www.w3.org/2000/svg" style="position: absolute; left: -9999px;">
<defs>
<linearGradient x1="49.9618961%" y1="100.171922%" x2="50.1943301%" y2="-0.605268409%" id="linearGradient-4">
<stop stop-color="#82CBAC" offset="0%"></stop>
<stop stop-color="#006838" offset="100%"></stop>
</linearGradient>
</defs>
<symbol id="geyser" viewBox="0 0 118 106">
<path style="opacity: 0" class="gsmoke" d="M42.1928517,64.8261864 C42.1928517,64.8261864 39.6937643,68.9359322 37.5895057,69.1739831 C37.5895057,69.1739831 32.7124715,72.0934746 31.4606844,68.9134746 C31.4606844,68.9134746 30.1909506,67.6783051 27.3688213,67.8714407 C27.3688213,67.8714407 22.6847148,64.2198305 27.7860837,61.2958475 C27.7860837,61.2958475 21.1771863,56.5707627 26.1439544,54.1094068 C26.1439544,54.1094068 32.2189354,46.1234746 37.221597,50.8036441 C37.221597,50.8036441 42.5697338,52.6002542 38.5406844,55.744322 C38.5406844,55.744322 35.8486692,56.5662712 36.7774144,59.009661 C36.7774144,59.009661 42.5562738,60.0157627 42.1973384,64.8486441" id="g-smoke-3" fill="#F1EFEF"></path>
<path style="opacity: 0" class="gsmoke" d="M90.5324715,61.2105085 C90.5324715,61.2105085 92.1387072,66.8563559 86.9431179,67.3998305 C86.9431179,67.3998305 82.6987072,66.3488136 83.9504943,63.685339 C83.9504943,63.685339 82.1019772,65.5313559 81.4469202,63.3439831 C81.4469202,63.3439831 77.4088973,58.7222034 80.5495817,56.7863559 C80.5495817,56.7863559 81.6174144,55.2008475 80.8726236,52.2409322 C80.8726236,52.2409322 83.8562738,46.5681356 87.9346768,51.4279661 C87.9346768,51.4279661 92.3720152,50.9788136 88.791635,48.3333051 C88.791635,48.3333051 91.690038,43.5049153 95.2749049,48.3063559 C95.2749049,48.3063559 104.921293,53.2470339 100.905703,59.4318644 C100.905703,59.4318644 100.008365,65.4505085 95.9120152,61.7764407 C95.9120152,61.7764407 94.5256274,59.0815254 92.1073004,60.5277966 L90.5324715,61.2105085 Z" id="g-smoke-2" fill="#F1EFEF"></path>
<path style="opacity: 0" class="gsmoke" d="M61.3644867,9.20762712 C61.3644867,9.20762712 55.5721673,5.73567797 59.5698099,1.25762712 C59.5698099,1.25762712 63.9892015,-1.14983051 65.0211407,2.03915254 C65.0211407,2.03915254 65.133308,-0.934237288 67.4080608,0.386271186 C67.4080608,0.386271186 74.4476806,1.12288136 73.3125475,5.16525424 C73.3125475,5.16525424 73.6535361,7.31669492 76.6057795,9.20762712 C76.6057795,9.20762712 78.535057,16.250339 71.266616,15.3520339 C71.266616,15.3520339 67.8612167,19.1563559 72.9715589,18.5994068 C72.9715589,18.5994068 74.3175665,24.8875424 67.5067681,23.6388983 C67.5067681,23.6388983 55.4824335,26.9985593 54.0063118,18.6982203 C54.0063118,18.6982203 50.0311027,12.9894915 56.3932319,12.8592373 C56.3932319,12.8592373 59.6864639,14.0360169 60.5927757,10.9548305 L61.3644867,9.20762712 Z" id="g-smoke-1" fill="#F1EFEF"></path>
<ellipse id="pr1" class="projectiles" fill="#DCDBDB" cx="48.0704183" cy="34.355678" rx="4.78730038" ry="4.79245763"></ellipse>
<ellipse id="pr2" class="projectiles" fill="#DCDBDB" cx="44.0638023" cy="39.3412712" rx="1.8530038" ry="1.855"></ellipse>
<ellipse id="pr3" class="projectiles" fill="#DCDBDB" cx="50.15673" cy="47.9874576" rx="1.81711027" ry="1.8190678"></ellipse>
<ellipse id="pr4" class="projectiles" fill="#DCDBDB" cx="49.3491255" cy="65.4505085" rx="1.4581749" ry="1.45974576"></ellipse>
<ellipse id="pr5" class="projectiles" fill="#DCDBDB" cx="71.5044106" cy="45.0095763" rx="1.78570342" ry="1.78762712"></ellipse>
<ellipse id="pr6" class="projectiles" fill="#DCDBDB" cx="61.8759696" cy="33.5202542" rx="1.57034221" ry="1.5720339"></ellipse>
<ellipse id="Oval" class="geyser-balls" fill="#DCDBDB" cx="50.9777947" cy="36.3364407" rx="12.0153612" ry="12.0283051"></ellipse>
<ellipse id="Oval" class="geyser-balls" fill="#DCDBDB" cx="59.8749049" cy="41.6499153" rx="7.28190114" ry="7.28974576"></ellipse>
<ellipse id="Oval" class="geyser-balls" fill="#DCDBDB" cx="69.4629658" cy="49.3483898" rx="7.43893536" ry="7.44694915"></ellipse>
<polygon id="geyser-shoot" fill="#DCDBDB" points="76.7089734 48.050339 73.3170342 85.3973729 47.4422814 85.3973729 45.4322433 46.469322"></polygon>
<ellipse id="Oval" class="geyser-balls" fill="#DCDBDB" cx="74.6450951" cy="54.5720339" rx="3.57140684" ry="3.57525424"></ellipse>
<ellipse id="Oval" class="geyser-balls" fill="#DCDBDB" cx="65.7659316" cy="38.6495763" rx="10.095057" ry="10.1059322"></ellipse>
<ellipse id="Oval" class="geyser-balls" fill="#DCDBDB" cx="50.318251" cy="56.1395763" rx="7.76646388" ry="7.77483051"></ellipse>
<ellipse id="Oval" class="geyser-balls" fill="#DCDBDB" cx="46.7872243" cy="64.5072881" rx="3.07787072" ry="3.08118644"></ellipse>
<ellipse id="Oval" class="geyser-balls" fill="#DCDBDB" cx="73.9855513" cy="59.8540678" rx="4.25787072" ry="4.26245763"></ellipse>
<path d="M0.237794677,101.521949 L0.659543726,101.292881 L43.6869202,77.815678 C43.6869202,77.815678 57.295057,85.9902542 76.7897338,77.5461864 L117.98654,100.560763 C117.98654,100.560763 62.8944487,111.565 1.71391635,101.508475 L0.237794677,101.521949 Z" id="Shape" fill="url(#linearGradient-4)"></path>
</symbol>
</svg>
<div class="container">
<div class="row">
<!-- Height is a bit larger to prevent animation from being cut out -->
<svg viewBox="0 0 118 160" width="200px" height="500px">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#geyser"></use>
</svg>
</div>
</div>
html, body {
height: 100%;
}
body {
margin: 0;
background: #76c5dd;
}
.container {
height: 100%;
padding: 0;
margin: 0;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
align-items: center;
justify-content: center;
}
.row {
width: auto;
}
svg, use {
display: block;
}
var geyserBalls = document.getElementsByClassName('geyser-balls');
var smoke1 = document.getElementById('g-smoke-1');
var smoke2 = document.getElementById('g-smoke-2');
var smoke3 = document.getElementById('g-smoke-3');
var pr = document.getElementById('pr2');
var projectiles = document.getElementsByClassName('projectiles');
var timeline = new TimelineMax({ repeat: -1, repeatDelay: 0 });
TweenMax.to(
projectiles[1],
0.9,
{
scale: 2.5,
x: Math.cos(30) * 10 * 6,
y: Math.sin(30) * 10 * 6,
repeat: -1
}
)
TweenMax.to(
projectiles[2],
0.9,
{
scale: 4,
x: Math.cos(80) * 50 * 6,
y: Math.sin(300) * 10 * 6,
repeat: -1
}
)
TweenMax.to(
projectiles[3],
0.9,
{
scale: 2.5,
x: Math.cos(100) * 10 * 6,
y: Math.sin(80) * 10 * 6,
repeat: -1
}
)
TweenMax.to(
projectiles[4],
0.9,
{
scale: 1.3,
x: Math.cos(-50) * 10 * 6,
y: Math.sin(-50) * 10 * 6,
repeat: -1
}
)
TweenMax.staggerFromTo(
geyserBalls,
0.05,
{
y: '-2px',
ease: Power1.ease
},
{
y: '2px',
repeat: -1,
yoyo: true,
ease: Power1.ease
}
)
timeline.fromTo(
smoke1,
2.3,
{
scale: 0,
x: '-10px',
y: '50px',
opacity: 0.8,
ease: Power1.easeInOut
},
{
scale: 2,
opacity: 0,
y: '-15px',
ease: Power1.easeInOut
}
).fromTo(
smoke2,
2.3,
{
scale: 0,
x: '-30px',
y: '-10px',
opacity: 0.8,
ease: Power1.easeInOut
},
{
scale: 2,
opacity: 0,
y: '-60px',
ease: Power1.easeInOut
},
'-=1.9'
).fromTo(
smoke3,
2.3,
{
scale: 0,
x: '20px',
y: '-10px',
opacity: 0.8,
ease: Power1.easeInOut
},
{
scale: 2.2,
opacity: 0,
y: '-70px',
ease: Power1.easeInOut
},
'-=2.1'
)
timeline.timeScale(1.2)
Also see: Tab Triggers