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 enable-background="new 0 0 512 512" height="512px" id="Layer_1" version="1.1" viewBox="0 0 512 512" width="512px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g>
<path d="M252,497c0,8.284-6.716,15-15,15l0,0c-8.284,0-15-6.716-15-15v-6c0-8.284,6.716-15,15-15l0,0 c8.284,0,15,6.716,15,15V497z" fill="#FEAA47"></path>
<path d="M121,490c0,7.18-5.82,13-13,13H72c-7.18,0-13-5.82-13-13l0,0c0-7.18,5.82-13,13-13h36 C115.18,477,121,482.82,121,490L121,490z" fill="#FEAA47"></path>
<polygon class="tail" fill="#FEAA47" points="252.961,242.686 477.979,153.222 468.164,270.374 317.451,291.637 362.314,365.699 274.69,396.443 311.142,437 276.094,437 269.784,351.059 297.123,339.809 248.755,280.207 "></polygon>
<path d="M253.142,71.18c0,0,47.136-53.337,70.269-58.595c23.133-5.257-37.599,89.902-37.599,89.902l-21.811-14.721L253.142,71.18z"></path>
<path d="M157.276,128.774c0,0,89.376-11.566,104.623,97.263c15.247,108.829,8.097,94.157,7.886,108.829 c-0.188,13.143,18.401,97.263,15.772,110.406c-2.628,13.144-9.989,37.854-35.75,41.008c-25.762,3.155-60.986-5.783-86.222-5.257 c-25.236,0.525-76.233,8.412-93.583-5.783s-27.338-36.803-23.133-49.42c4.206-12.618,32.071-115.664,27.865-121.447 s-32.596-67.821-6.309-115.138s12.092-19.453,12.092-19.453S98.918,128.774,157.276,128.774z" fill="#FEC85B"></path>
<path d="M66.848,289.302c0,0-12.968,37.504-7.009,58.884c5.958,21.38,27.689,64.141,37.854,71.501 c10.164,7.36,31.544-33.646,22.782-58.182S82.62,301.921,66.848,289.302z" fill="#FEAA47"></path>
<ellipse cx="69.213" cy="266.256" fill="#EB594C" rx="17.086" ry="25.499" transform="matrix(0.9747 -0.2235 0.2235 0.9747 -57.7507 22.201)"></ellipse>
<ellipse cx="219.052" cy="268.351" fill="#EB594C" rx="26.088" ry="25.499" transform="matrix(0.993 -0.1178 0.1178 0.993 -30.0868 27.6731)"></ellipse>
<ellipse class="eye" id="left-eye" cx="81.569" cy="220.78" rx="16.298" ry="17.875"></ellipse>
<circle class="reflection" cx="84.986" cy="213.157" fill="#FFFFFF" r="6.572"></circle>
<ellipse class="eye" id="right-eye" cx="186.718" cy="223.934" rx="16.298" ry="17.875"></ellipse>
<circle class="reflection" cx="183.826" cy="216.311" fill="#FFFFFF" r="6.572"></circle>
<circle cx="119.685" cy="246.804" r="3.943"></circle>
<path d="M98.784,265.429c0,0,4.396,6.421,11.374,5.723s12.771-4.632,12.771-4.632s6.21,4.948,15.84,4.686 c9.63-0.263,14.166-5.776,14.166-5.776s-4.675,9.979-13.607,9.979c-8.932,0-17.446-5.373-17.446-5.373s-4.536,5.304-11.514,4.955 C103.389,274.641,99.272,269.687,98.784,265.429z"></path>
<path d="M213.53,144.021c0,0,26.486-66.77,50.308-83.067c23.822-16.298,27.502,34.173,25.399,37.854 c-2.104,3.68-47.843,70.45-51.523,70.45S213.53,144.021,213.53,144.021z" fill="#FEC85B"></path>
<path d="M90.231,77.648c0,0-28.466-65.241-48.863-77.353c-20.398-12.112,8.153,97.106,8.153,97.106l25.278-7.307L90.231,77.648z"></path>
<path d="M105.542,159.137c0,0-4.688-71.678-22.348-94.507c-17.661-22.83-36.672,24.068-35.802,28.217 c0.87,4.148,23.879,81.743,27.381,82.874C78.276,176.851,105.542,159.137,105.542,159.137z" fill="#FEC85B"></path>
<path d="M255.064,297.713c-7.36-1.752-50.471,22.081-61.336,37.504c-10.865,15.422-33.998,61.336-33.998,69.397 c0,8.062,3.854,22.082,17.174,25.938s36.802-7.711,51.173-27.688c14.37-19.979,43.46-57.832,39.957-74.656 C264.527,311.384,262.424,299.466,255.064,297.713z" fill="#FEAA47"></path>
</g>
</svg>
body {
margin: 50px;
}
.eye,
.reflection .tail {
position: absolute;
}
.eye {
animation: eyesMove 4s infinite;
}
.reflection {
animation: reflections 4s infinite;
}
.tail {
animation: tail 3s infinite;
animation-delay: 500ms;
}
@keyframes eyesMove {
0% {
transform: translateX(0);
}
50% {
transform: translateX(5px)
}
100% {
transform: translateX(0);
}
}
@keyframes reflections {
0% {
transform: translateX(0);
}
50% {
transform: translateX(10px)
}
100% {
transform: translateX(0);
}
}
@keyframes tail {
0% {
transform: rotateY(0);
}
25% {
transform: rotateY(10deg);
}
75% {
transform: rotateY(5deg);
}
100% {
transform: rotateY(0deg);
}
}
Also see: Tab Triggers