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.
<div class="info">
<h1>dotLottie Web</h1>
</div>
<label>Themes:
<select id="themes-selector">
<option value="" selected>None</option>
</select>
</label>
<a href="https://github.com/lottiefiles/dotlottie-web" target="_blank">
<canvas id="dotLottie-canvas">
</canvas>
</a>
<svg id="LottieFilesLogo" xmlns="http://www.w3.org/2000/svg" width="401" height="79" viewBox="0 0 401 79" fill="none">
<g clip-path="url(#clip0_274_2135)">
<path d="M313.847 28.1592H304.374V61.5326H313.847V28.1592Z" fill="black" />
<path d="M313.847 17.1592H304.374V24.5385H313.847V17.1592Z" fill="black" />
<path d="M107.249 17.1592H97.3477V61.5318H127.583V53.0246H107.249V17.1592Z" fill="black" />
<path d="M147.151 25.3818C136.612 25.3818 128.27 33.5345 128.27 43.8086C128.27 54.0828 136.612 62.2569 147.151 62.2569C157.691 62.2569 166.103 54.1042 166.103 43.8247C166.103 33.5453 157.755 25.3818 147.151 25.3818ZM147.151 53.449C141.847 53.449 137.887 49.4102 137.887 43.7818C137.887 38.1533 141.847 34.1468 147.151 34.1468C152.456 34.1468 156.416 38.2553 156.416 43.7818C156.416 49.3082 152.456 53.449 147.151 53.449Z" fill="black" />
<path d="M205.834 54.0178C204.135 54.0178 202.651 53.0242 202.651 49.979V35.8058H211.685V28.158H202.651V18.5391H193.178V28.158H180.737V18.5391H171.263V28.158H166.104V35.8058H171.263V50.1187C171.263 58.1264 175.084 62.2403 182.151 62.2403C185.342 62.2466 188.465 61.3128 191.131 59.555L188.452 52.5408C187.111 53.4498 185.542 53.9651 183.924 54.0285C182.226 54.0285 180.742 53.0349 180.742 49.9898V35.8058H193.183V50.1187C193.183 58.1264 196.998 62.2403 204.071 62.2403C207.262 62.2456 210.385 61.3119 213.051 59.555L210.372 52.5408C209.027 53.4492 207.455 53.9609 205.834 54.0178Z" fill="black" />
<path d="M265.726 41.3117C264.28 31.3491 255.616 24.3028 246.094 25.6938C243.7 26.0214 241.395 26.825 239.314 28.0574C237.234 29.2898 235.419 30.9261 233.978 32.8705C232.537 34.8149 231.497 37.0282 230.921 39.3806C230.344 41.733 230.242 44.1771 230.62 46.5696C232.297 58.1434 242.226 63.5034 252.438 62.0103C257.063 61.3586 261.396 59.3584 264.896 56.2583L260.416 50.0337C257.859 52.2489 254.719 53.6774 251.372 54.1477C246.753 54.819 242.429 53.0735 240.607 48.4118L266.005 44.706C265.975 43.5703 265.882 42.4371 265.726 41.3117ZM239.557 42.1872C239.825 37.6382 242.901 34.1795 246.957 33.5941C249.018 33.2728 251.125 33.7157 252.883 34.8398C254.642 35.9639 255.932 37.692 256.51 39.7005L239.557 42.1872Z" fill="black" />
<path d="M368.564 41.3117C367.117 31.3491 358.448 24.3028 348.932 25.6938C346.537 26.0207 344.232 26.8239 342.151 28.056C340.07 29.2882 338.256 30.9246 336.814 32.8692C335.373 34.8137 334.333 37.0273 333.757 39.38C333.181 41.7327 333.079 44.177 333.458 46.5696C335.135 58.1434 345.058 63.5034 355.276 62.0103C359.9 61.3585 364.23 59.3582 367.728 56.2583L363.254 50.0337C360.695 52.2491 357.553 53.6775 354.204 54.1477C349.586 54.819 345.262 53.0735 343.44 48.4118L368.843 44.706C368.809 43.5705 368.716 42.4375 368.564 41.3117ZM342.395 42.1872C342.663 37.6382 345.733 34.1795 349.795 33.5941C351.853 33.2713 353.958 33.714 355.714 34.8387C357.47 35.9633 358.754 37.6924 359.327 39.7005L342.395 42.1872Z" fill="black" />
<path d="M329.402 17.1592H319.929V61.5264H329.402V17.1592Z" fill="black" />
<path d="M388.181 39.3456C384.929 38.6367 381.96 37.9975 381.96 36.0158C381.96 34.5281 384.012 33.5345 386.204 33.5345C389.626 33.5889 392.99 34.4383 396.03 36.0158L399.213 28.9264C395.259 26.5022 390.692 25.2716 386.059 25.3818C379.415 25.3818 372.342 29.2111 372.342 36.44C372.342 43.2447 378.07 45.5702 385.073 47.4231C388.111 48.277 391.155 48.7711 391.155 50.8979C391.155 53.0247 387.549 53.8733 385.352 53.8733C381.351 53.9514 377.449 52.6211 374.325 50.1138L370.928 57.4233C372.91 59.2654 377.786 62.2569 385.352 62.2569C391.931 62.2569 400.767 59.3513 400.767 50.6294C400.767 43.3843 394.214 40.7742 388.181 39.3456Z" fill="black" />
<path d="M226.334 28.1592H216.86V61.5326H226.334V28.1592Z" fill="black" />
<path d="M226.334 17.1592H216.86V24.5385H226.334V17.1592Z" fill="black" />
<path d="M269.761 61.5318H279.641V43.4003H296.396V34.9845H279.641V25.6502H299.997V17.1592H269.761V61.5318Z" fill="black" />
<path d="M59.0965 0.59082H20.5503C9.64568 0.59082 0.805664 9.45154 0.805664 20.3818V59.0185C0.805664 69.9487 9.64568 78.8094 20.5503 78.8094H59.0965C70.0011 78.8094 78.8411 69.9487 78.8411 59.0185V20.3818C78.8411 9.45154 70.0011 0.59082 59.0965 0.59082Z" fill="#00DDB3" />
<path d="M60.1139 18.1094C46.6811 18.1094 41.7034 27.7229 37.7009 35.446L35.0862 40.387C30.8479 48.5773 27.6814 53.5559 19.521 53.5559C19.0144 53.5559 18.5127 53.6559 18.0447 53.8502C17.5766 54.0446 17.1513 54.3294 16.793 54.6885C16.4348 55.0475 16.1505 55.4738 15.9566 55.943C15.7628 56.4121 15.6631 56.915 15.6631 57.4228C15.6645 58.4479 16.0714 59.4306 16.7946 60.1555C17.5178 60.8804 18.4983 61.2883 19.521 61.2897C32.9591 61.2897 37.9367 51.6761 41.9392 43.9531L44.5487 39.0121C48.7923 30.8218 51.9588 25.8432 60.1139 25.8432C60.6209 25.8439 61.1231 25.7444 61.5918 25.5503C62.0605 25.3563 62.4864 25.0716 62.8452 24.7125C63.204 24.3533 63.4888 23.9268 63.683 23.4573C63.8772 22.9878 63.977 22.4845 63.977 21.9763C63.9756 20.9502 63.568 19.9667 62.8437 19.2416C62.1193 18.5166 61.1375 18.1094 60.1139 18.1094Z" fill="white" />
</g>
<defs>
<clipPath id="clip0_274_2135">
<rect width="400" height="78.232" fill="white" transform="translate(0.805664 0.59082)" />
</clipPath>
</defs>
</svg>
canvas {
width: 350px;
height: 350px;
}
/* Styles Configuration */
@font-face {
font-family: "Arboria";
src: url("https://assets.codepen.io/11716235/arboria-bold-webfont.woff2")
format("woff2");
}
#LottieFilesLogo {
width: 100px;
position: absolute;
left: 24px;
}
/* Brand-based color variables */
:root {
--color-mint: #019d91;
--color-mint-dark: #00c1a2;
--color-white: #ffffff;
--color-black: #000000;
--color-orange: #ff7100;
--color-red: #ff3c00;
--color-green: #00951d;
--color-blue: #00c6ff;
--background-color: var(--color-white);
--text-color: var(--color-black);
--accent-color: var(--color-mint);
--btn-hover: var(--color-mint-dark);
}
/* Base styles */
body {
display: flex;
flex-direction: column;
align-items: center;
height: 100vh;
font-family: "Arboria", "Helvetica Neue", sans-serif;
background-color: var(--background-color);
color: var(--text-color);
margin: 0;
padding: 0;
line-height: 1.6;
}
/* Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: 700;
margin-bottom: 0.5rem;
}
/* Links */
a {
color: var(--accent-color);
text-decoration: none;
transition: all 0.2s ease;
}
a:hover {
text-decoration: underline;
}
/* Buttons */
button {
background-color: var(--accent-color);
color: var(--color-white);
border: none;
margin: 10px;
padding: 0.75rem 1.5rem;
font-weight: 600;
border-radius: 0.5rem;
cursor: pointer;
transition: background-color 0.3s ease, transform 0.2s ease;
}
button:hover {
background-color: var(--btn-hover);
transform: scale(1.05);
}
import { DotLottie } from "https://esm.sh/@lottiefiles/dotlottie-web@0.37.0";
const canvas = document.querySelector("#dotLottie-canvas");
const themesSelector = document.querySelector("#themes-selector");
const src =
"https://lottie.host/9a5a6605-fc90-4935-8d10-9df4c83902ff/PFUKH53LJk.lottie";
const dotLottie = new DotLottie({
canvas,
src,
loop: true,
autoplay: true
});
themesSelector.addEventListener("change", () => {
const themeId = themesSelector.value;
if (themeId) {
dotLottie.setTheme(themeId);
} else {
dotLottie.resetTheme();
}
});
dotLottie.addEventListener("load", () => {
const themes = dotLottie.manifest?.themes || [];
themesSelector.innerHTML = "";
const noneOption = document.createElement("option");
noneOption.value = "";
noneOption.textContent = "None";
noneOption.selected;
themesSelector.appendChild(noneOption);
for (const theme of themes) {
const option = document.createElement("option");
option.textContent = theme.id;
option.value = theme.id;
themesSelector.appendChild(option);
}
});
Also see: Tab Triggers