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.
<div class="container">
<svg version="1.1" viewBox="0 0 177 206" width="300" height="300" style="width: 100%;">
<g class="all">
<g>
<path id="rope" fill="#E6E6E6" d="M92.5,103c-31.849,0-43.598-24.373-47.171-34.853C40.908,55.184,38.117-20.819,38-23h5
c0.028,0.527,2.863,77.22,7.061,89.534C53.287,75.995,63.88,98,92.5,98c30.449,0,43.982-4.324,48.972-31.117
C146.681,38.911,146.007-22.619,146-23h5c0.006,0.386,0.688,62.338-4.612,90.798C140.813,97.732,124.57,103,92.5,103z"/>
</g>
<g id="sloth">
<path fill="#AE4399" d="M97.848,124.04c1.234-2.149,2.241-4.373,3.033-6.646c0.427-1.226,0.791-2.465,1.092-3.713
c0.994-4.124,1.312-7.345,0.967-11.503c-1.175-2.611-3.145-4.566-5.715-5.294c-2.221-0.629-4.542-0.238-6.661,0.914
c0.73,2.588,1.038,7.667,1.021,8.018c-0.105,3.352-0.905,6.875-2.243,10.131c-0.04,0.11-0.09,0.21-0.14,0.31
c0.121-0.393,0.224-0.789,0.318-1.188c0.557-2.369,0.629-4.824,0.132-7.273c-1.125-5.559-4.918-10.026-10.127-12.742
c-4.075-2.125-9.017-3.174-14.23-2.833c-1.334,0.087-2.684,0.261-4.043,0.535c-5.469,1.105-10.218,3.6-13.78,6.913
c-5.205,4.84-7.874,11.425-6.55,17.967c1.56,7.72,8.25,13.33,16.75,15.06c1.537,4.099,3.739,7.871,6.469,11.192
c0.024,0,0.049,0,0.074,0c7.241,8.716,18.161,14.268,30.378,14.268c21.803,0,39.479-17.675,39.479-39.478
c0-1.211-0.063-2.407-0.17-3.591c-0.038-0.398-0.078-0.796-0.129-1.191c-0.037-0.304-0.072-0.609-0.116-0.911
c-0.257-1.708-0.62-3.382-1.088-5.011c0-0.024,0.001-0.048,0.001-0.073c-1.521-5.37-4.142-10.278-7.617-14.454
c-2.461-1.465-5.198-1.937-7.721-1.057c-2.18,0.76-3.856,2.411-4.931,4.571c3.54,2.891,6.361,6.628,8.151,10.906
c0.695,1.66,1.236,3.401,1.602,5.205c0.386,1.842,0.593,3.749,0.596,5.705c0,0.017,0.001,0.033,0.001,0.05
c0,1.84-0.19,3.63-0.52,5.37h-24.05 M80.985,123.151c-0.313,0.304-0.636,0.6-0.97,0.889c-3.161,2.733-7.258,4.792-11.934,5.736
c-1.84,0.37-3.67,0.55-5.46,0.55c-2.067,0-4.065-0.252-5.959-0.706c-7.207-1.727-12.818-6.545-14.141-13.094
c-0.48-2.39-0.37-4.82,0.34-7.23c1.552-3.584,4.679-6.146,8.408-6.966c0.068-0.015,0.133-0.04,0.202-0.054
c2.378-0.481,4.773-0.213,6.911,0.668c1.997,0.823,3.77,2.181,5.089,3.982c1.07-4.57,4.66-8.09,9.26-8.95
c0.18-0.03,0.36-0.04,0.54-0.05c0.861-0.027,1.674-0.037,2.476,0.009c0.679,0.039,1.351,0.115,2.034,0.271
c1.31,0.3,2.8,0.97,4.11,1.83c1.13,0.76,2.39,1.72,3.2,3.12c0.78,1.37,1.09,2.92,1.4,4.42
C87.627,113.21,85.387,118.878,80.985,123.151z"/>
<path fill="#AE4399" d="M83.791,103.246l-3.54-0.5c-0.34-0.05-0.67-0.07-0.99-0.07c-3.44,0-6.45,2.53-6.95,6.03
c-0.26,1.86,0.21,3.7,1.34,5.2c1.13,1.5,2.77,2.47,4.62,2.74l5.52,0.78c1.74-3.2,2.3-6.63,1.63-9.93
C85.121,106.016,84.581,104.586,83.791,103.246z"/>
<path fill="#AE4399" d="M55.165,120.717c0.913-0.896,1.573-2.025,1.895-3.292c0.45-1.82,0.18-3.71-0.79-5.32
c-0.145-0.244-0.308-0.473-0.479-0.694c-0.956-1.239-2.287-2.116-3.831-2.506c-1.82-0.46-3.71-0.18-5.32,0.79l-3.07,1.84
c-0.2,1.53-0.15,3.06,0.15,4.55c0.66,3.3,2.51,6.23,5.36,8.51l4.78-2.86C54.341,121.448,54.774,121.102,55.165,120.717z"/>
<path fill="#AE4399" d="M72.851,114.506c-1.29-1.71-1.83-3.82-1.53-5.94c0.63-4.38,4.69-7.44,9.07-6.81l2.56,0.36
c-0.52-0.48-1.08-0.89-1.62-1.24c-1.2-0.81-2.58-1.43-3.78-1.7c-0.927-0.211-1.837-0.269-2.817-0.271
c-0.457-0.001-0.924,0.005-1.423,0.021c-0.14,0.01-0.27,0.01-0.39,0.04c-4.59,0.85-8.08,4.61-8.69,9.35l-0.18,1.47l-0.75-1.28
c-1.237-2.143-3.123-3.744-5.302-4.643c-1.309-0.54-2.723-0.827-4.167-0.827c-0.468,0-0.936,0.042-1.406,0.103
c-0.254,0.033-0.508,0.064-0.764,0.117c-3.49,0.71-6.43,3.09-7.86,6.38c-0.07,0.23-0.11,0.46-0.16,0.69l2.49-1.49
c1.84-1.1,4-1.42,6.07-0.9c1.491,0.373,2.807,1.152,3.841,2.238c0.409,0.429,0.777,0.901,1.089,1.422c1.1,1.84,1.42,3.99,0.9,6.07
c-0.431,1.724-1.404,3.215-2.77,4.303c-0.282,0.225-0.575,0.438-0.89,0.627l-4.71,2.82c1.927,1.377,4.2,2.426,6.687,3.092
c3.528,0.944,7.49,1.109,11.543,0.288c4.06-0.822,7.659-2.514,10.55-4.756c0.603-0.468,1.175-0.958,1.714-1.471
c1.338-1.275,2.475-2.678,3.367-4.173l-5.39-0.76C76.011,117.326,74.141,116.226,72.851,114.506z M67.381,122.086
c-0.198,0.04-0.394,0.065-0.586,0.081c-1.497,0.129-2.768-0.422-2.954-1.361c-0.209-1.055,1.01-2.188,2.737-2.544
c0.008-0.002,0.015-0.004,0.023-0.006c1.74-0.35,3.33,0.22,3.54,1.28S69.121,121.736,67.381,122.086z"/>
<circle class="eye eye-right" fill="#ffffff" cx="76.787" cy="110.856" r="1.5"/>
<circle class="eye eye-left" fill="#ffffff" cx="51.787" cy="114.856" r="1.5"/>
</g>
<g id="helmet">
<path fill="#FFDD00" d="M84.984,88.862c-0.26,0.232-0.532,0.46-0.806,0.688l-1.032-5.048l-2.007,0.41
c-2.945-8.71-10.935-14.644-19.939-15.096l-0.698-3.415l-10,2.045l0.655,3.205c-8.324,3.624-13.665,12.041-13.342,21.174
l-2.128,0.435l1.139,5.571c-0.077-0.025-0.158-0.047-0.234-0.073c0.141,0.548,0.324,1.079,0.545,1.594l0.037,0.181l0.043-0.009
c3.301,7.362,14.569,11.227,26.732,8.74C77.051,106.586,86.311,97.532,84.984,88.862z"/>
<polygon fill="#ffffff" points="52.521,78.326 50.501,68.447 60.501,66.402 62.546,76.402 63.526,76.202 61.481,66.202 61.28,65.222
60.301,65.423 50.3,67.468 49.321,67.668 49.521,68.648 51.566,78.648 52.546,78.448 "/>
<path fill="#ffffff" d="M84.984,88.862c1.327,8.67-7.933,17.723-21.036,20.403c-2.498,0.511-4.956,0.754-7.317,0.754
c-10.027,0-18.273-4.384-20.04-11.26c3.729,1.257,8.241,1.935,13.193,1.935c3.839,0,7.944-0.408,12.152-1.268
C71.572,97.455,79.772,93.514,84.984,88.862 M85.693,86.889l-1.375,1.228c-5.276,4.709-13.507,8.474-22.582,10.33
c-4.049,0.828-8.07,1.248-11.952,1.248c-4.769,0-9.221-0.651-12.873-1.883l-1.747-0.589l0.459,1.785
c1.846,7.184,10.289,12.011,21.008,12.011c2.477,0,5.006-0.26,7.517-0.774c13.659-2.793,23.245-12.252,21.824-21.534L85.693,86.889
L85.693,86.889z"/>
</g>
<g id="tools">
<path id="toolbelt" fill="#F7931E" d="M112.163,127.095l-6.964-0.395c-0.01-0.928-0.032-1.871-0.078-2.844l-5.5,0.333
c0,0,1.667,19.167-9.333,33.833l5.333,0.5c0,0,2.285-2.183,4.624-6.951l6.521,2.335c1.003,0.359,2.108-0.163,2.467-1.166
l2.407-6.723c0.359-1.003-0.163-2.108-1.166-2.467l-6.665-2.387c0.243-1.104,0.46-2.269,0.649-3.488l7.081,0.402
c1.064,0.06,1.976-0.753,2.036-1.817l0.405-7.129C114.041,128.067,113.227,127.156,112.163,127.095z"/>
<g class="hammer">
<rect x="101.992" y="129.933" transform="matrix(0.2468 -0.9691 0.9691 0.2468 -63.9556 210.5782)" fill="#FFDD00" width="3" height="33"/>
<path fill="#F7931E" d="M90.847,137.539c-3.398,1.01-5.466,4.334-5.015,7.74l-1.591-0.405l-1.053,4.133l6.35,1.618
c0.015,0.008,0.03,0.018,0.045,0.026c-0.001-0.005-0.002-0.01-0.003-0.016l1.185,0.302l1.053-4.133l-2.255-0.574
c0.757-3.409,3.278-6.317,6.863-7.383c0.236-0.07,0.472-0.12,0.709-0.172C95.397,137.371,93.09,136.872,90.847,137.539z"/>
</g>
<rect id="tool_strap" x="98.962" y="141.882" transform="matrix(0.9577 0.2878 -0.2878 0.9577 46.369 -22.8682)" fill="#F79120" width="4" height="8.784"/>
</g>
</g>
<ellipse fill="#E6E6E6" class="shadow" cx="92" cy="193" rx="33" ry="6"/>
</svg>
</div>
.container {
width: 400px;
margin-left: auto;
margin-right: auto;
}
.eye {
animation-timing-function: ease-in-out;
animation-duration: 6s;
animation-iteration-count: infinite;
}
.eye-left {
animation-name: blink-left;
}
.eye-right {
animation-name: blink-right;
}
.all {
animation-name: swing;
animation-timing-function: ease-in-out;
animation-duration: 8s;
animation-iteration-count: infinite;
}
.shadow {
animation-name: swing-shadow;
animation-timing-function: ease-in-out;
animation-duration: 8s;
animation-iteration-count: infinite;
}
.hammer {
animation-name: swing-hammer;
animation-timing-function: ease-in-out;
animation-duration: 8s;
animation-iteration-count: infinite;
}
@keyframes blink-left {
0% {
transform: none;
}
85% {
transform: none;
}
90% {
transform: translateY(115px) scaleY(0);
}
93% {
transform: none;
}
100% {
transform: none;
}
}
@keyframes blink-right {
0% {
transform: none;
}
85% {
transform: none;
}
90% {
transform: translateY(111px) scaleY(0);
}
93% {
transform: none;
}
100% {
transform: none;
}
}
@keyframes swing {
0% { transform: translate(28px, 12px) rotate(-7deg); }
50% { transform: translate(-28px, -12px) rotate(7deg); }
100% { transform: translate(28px, 12px) rotate(-7deg); }
}
@keyframes swing-shadow {
0% {
transform: translateX(40px);
opacity: 0.2;
}
25% {
opacity: 0.5;
}
50% {
transform: translateX(-40px);
opacity: 0.2;
}
75% {
opacity: .5;
}
100% {
transform: translateX(40px);
opacity: 0.2;
}
}
@keyframes swing-hammer {
0% { transform: translate(-26px, 20px) rotate(-9deg); }
10% { transform: translate(-26px, 20px) rotate(-9deg); }
50% { transform: translate(8px, -4px) rotate(3deg); }
60% { transform: translate(8px, -4px) rotate(3deg); }
100% { transform: translate(-26px, 20px) rotate(-9deg); }
}
Also see: Tab Triggers