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.
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Alert Activated</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<svg id="success" width="112" height="112" viewBox="0 0 112 112" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle id="BG" cx="56" cy="56" r="56" fill="#EAFAEE"/>
<circle id="FG" cx="56" cy="56" r="43" fill="#84E199"/>
<g id="bell__box">
<path id="bell__icon" fill-rule="evenodd" clip-rule="evenodd" d="M58.7718 32.6691L74.0071 41.5394C77.5989 43.6306 78.8178 48.2947 76.744 51.9168L68.6854 65.9921C67.8366 67.4748 68.3597 69.3679 69.8301 70.2239L72.5541 71.81L67.5436 80.5614L64.6509 78.8772L31.384 59.5082L28.4912 57.8239L30.1614 54.9068L31.8316 51.9897L33.5017 49.0725L36.2257 50.6587C37.6961 51.5147 39.5834 51.0254 40.4326 49.5426L48.4913 35.4674C50.565 31.8453 55.18 30.5778 58.7718 32.6691ZM41.0922 69.0504L43.9849 70.7347C43.2612 71.9989 43.1082 72.2663 42.3841 73.5301C42.0362 74.1378 42.24 74.9046 42.8426 75.2555L45.3979 76.7431C45.9763 77.0802 46.761 76.8884 47.1089 76.2808C47.833 75.017 47.9859 74.7495 48.7096 73.4853L51.6023 75.1696C50.8787 76.4338 50.7257 76.7012 50.0016 77.965C48.735 80.1772 45.9214 80.9375 43.7278 79.6603L41.1725 78.1726C38.9788 76.8954 38.2249 74.058 39.4914 71.8458C40.2151 70.5816 40.3681 70.3142 41.0922 69.0504ZM51.3836 37.1512L43.3254 51.2265C41.5858 54.2653 37.7692 55.3171 34.7243 53.6739L33.0541 56.5911L66.321 75.9596L67.9912 73.0425C65.0577 71.2048 64.0527 67.3462 65.7923 64.3074L73.8509 50.2321C75.006 48.2145 74.3134 45.6071 72.3365 44.4561L57.1012 35.5858C55.1005 34.4209 52.5387 35.1336 51.3836 37.1512ZM69.9536 27.5088L72.8463 29.193L69.506 35.0273L66.6133 33.3431L69.9536 27.5088Z" fill="#1E7B33"/>
</g>
<g id="check__box">
<circle id="check__circle" cx="91" cy="30" r="11" fill="green" />
<path id="check__icon" d="M86 30.5L89.5 34L96.5 27" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</g>
</svg>
</body>
</html>
:root {
--easing1: cubic-bezier(0.65, 0, 0.45, 1);
--easing2: cubic-bezier(0.445, 0.050, 0.550, 0.950);
--easing3: cubic-bezier(0,0,.64,1.4);
}
body {
display: flex;
justify-content: center;
align-items: center;
position: relative;
height: 30vh;
zoom: 2;
}
body, #success {overflow: visible;}
#BG {
animation: sprang 3s 1 var(--easing2) both;
transform-origin: center;
transform-box: fill-box;
transform: scale(0);
}
#FG {
animation: sprang 3s 1 0.2s linear both;
transform-origin: center;
transform-box: fill-box;
transform: scale(0);
}
@keyframes sprang {
0% { transform: scale(0); }
8% { transform: scale(1.207); }
9% { transform: scale(1.184); }
17% { transform: scale(0.966); }
24% { transform: scale(1.008); }
30% { transform: scale(0.998); }
36% { transform: scale(0.999); }
37%, 44% { transform: scale(1.000); }
45%, 52% { transform: scale(0.999); }
53%, 60% { transform: scale(1.000); }
61%, 67% { transform: scale(0.999); }
68%, 75% { transform: scale(1.000); }
76%, 83% { transform: scale(0.999); }
84%, 91% { transform: scale(1.000); }
92%, 99% { transform: scale(0.999); }
100% { transform: scale(1.000); }
}
#check__box {
transform-origin: center;
transform-box: fill-box;
transform: scale(0) rotate(45deg);
animation: rotoScale 0.7s var(--easing1) 0.2s forwards;
}
#check__icon {
transform-origin: 50% 50%;
stroke-dasharray: 48;
stroke-dashoffset: 48;
animation: stroke 0.7s var(--easing1) 0.2s forwards;
}
@keyframes stroke {
100% { stroke-dashoffset: 0; }
}
@keyframes rotoScale {
0% { transform: scale(0) rotate(45deg); }
50% { transform: scale(1.2) rotate(0deg); }
80% { transform: scale(0.8) rotate(0deg); }
100% { transform: scale(1) rotate(0deg); }
}
#bell__box {
animation: ring-more 1.3s var(--easing3);
transform-origin: top right;
transform-box: fill-box;
}
#bell__icon {
animation: bounce var(--easing2) 1s;
transform-origin: top right;
transform-box: fill-box;
}
@keyframes ring {
15% {transform: rotate(-20deg);}
30% {transform: rotate(20deg);}
45% {transform: rotate(-10deg);}
60% {transform: rotate(3deg);}
85% {transform: rotate(0deg);}
100% {transform: rotate(0deg);}
}
@keyframes ring-more {
15%{transform:rotate(-20deg)}
30%{transform:rotate(20deg)}
45%{transform:rotate(-10deg)}
60%{transform:rotate(5deg)}
85%{transform:rotate(-3deg)}
100%{transform:rotate(0)}
}
@keyframes bounce {
0% { transform: scale(0); }
50% { transform: scale(1.2); }
70% { transform: scale(0.9); }
100% { transform: scale(1); }
}
Also see: Tab Triggers