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="container">
<svg class="item" width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.91627 6.59357C4.71627 8.94357 3.03999 12.2088 2.99999 16.4688C2.99999 20.924 3.93874 24.1995 6.08308 26.4299C5.18722 27.1072 4.56248 27.5938 4.56248 27.5938C4.03123 28.0834 3.71873 29.0156 5.09373 29.0156C5.56796 29.0156 5.99592 29.0219 6.38934 29.0277C7.51257 29.0443 8.35431 29.0567 9.18748 28.9063C9.36206 28.8748 9.52715 28.8386 9.68402 28.798C9.74422 28.8224 9.80486 28.8465 9.86596 28.8703C16.0684 26.6593 16.2241 25.89 16.5 21C16.6642 18.0889 19.0781 16.6094 21 16.5C22.4939 16.415 27.7075 16.1601 29.9554 16.0507C29.9748 15.6641 29.9794 15.2771 29.9687 14.8906C29.9687 12.2306 26.5156 9.99002 24.1663 9.99002H17.6163C14.1563 9.99002 11.3463 12.8 11.3463 16.26C11.5156 18.6719 7.97328 19.6662 7.52627 17.04C7.03349 14.1449 7.91405 10.8282 9.7578 8.50002C9.95311 8.45295 10.0662 8.45331 10.2031 8.5467C11.4609 9.80451 12.4413 9.85876 14.1328 9.46076C14.207 9.41307 14.2896 9.38571 14.3683 9.35964C14.5867 9.28731 14.7752 9.22485 14.6719 8.76545C14.5312 8.14045 13.4531 7.09357 13.4531 7.09357C12.6797 6.18732 11.5469 5.99982 11.0781 6.05451C10.827 6.0838 10.7045 6.1235 10.6348 6.14607C10.5744 6.16564 10.5538 6.17235 10.5234 6.14826C10.4581 6.09638 10.6094 5.78107 10.6094 5.78107C10.7734 4.90607 10.75 4.37482 10.2463 3.67002C10.2463 3.67002 9.44474 2.52335 8.72627 2.16002C8.0078 1.7967 7.71874 2.15997 7.56249 2.52349C7.07007 3.66911 7.0078 5.09375 7.91627 6.14826L7.92139 6.16047C7.99493 6.33602 8.01802 6.39113 8.00625 6.43738C8.00087 6.45854 7.98819 6.47785 7.9697 6.50599C7.95522 6.52804 7.93717 6.55552 7.91627 6.59357Z" fill="#00A6ED"/>
<path d="M24.8063 25H17.7863L21.5163 27.84C22.5063 28.59 23.7063 29 24.9463 29H28.3281C28.8381 29 29.0581 28.35 28.6481 28.04L24.8063 25Z" fill="#00A6ED"/>
<path d="M10.7556 28.3997C15.1539 26.899 15.2401 25.3587 15.4842 20.9994L15.5 20.7188C15.6643 17.8077 19.2656 16.1094 21.1875 16C23.1094 15.8907 29.9531 16 29.9531 16L29.9204 16.5717C29.3123 23.7672 23.6322 30.6245 15.9836 30.0947C13.4913 29.9221 11.4044 29.4964 9.68404 28.798C10.0887 28.6933 10.4387 28.5591 10.7556 28.3997Z" fill="#AEDDFF"/>
<path d="M16.483 15.0001C16.8133 15.0001 17.0873 14.7261 17.0873 14.3958V13.6384C17.0873 13.3081 16.8133 13.0342 16.483 13.0342C16.1527 13.0342 15.8787 13.3081 15.8787 13.6384V14.3958C15.8787 14.7342 16.1527 15.0001 16.483 15.0001Z" fill="#1C1C1C"/>
<path d="M13.9043 4.125C13.2323 4.125 12.6875 3.58022 12.6875 2.9082C12.6875 2.23618 13.2323 1.69141 13.9043 1.69141C14.5763 1.69141 15.1211 2.23618 15.1211 2.9082C15.1211 3.58022 14.5763 4.125 13.9043 4.125Z" fill="#26EAFC"/>
<path d="M27.9963 9C27.444 9 26.9963 8.55228 26.9963 8C26.9963 7.44772 27.444 7 27.9963 7C28.5486 7 28.9963 7.44772 28.9963 8C28.9963 8.55228 28.5486 9 27.9963 9Z" fill="#26EAFC"/>
<path d="M20.9963 2.83C20.4663 2.32 19.7663 2 18.9963 2C17.3363 2 15.9963 3.34 15.9963 5V5.47C15.9963 6.31 16.6863 7.02 17.5263 7C18.3363 6.98 18.9963 6.32 18.9963 5.5C18.9963 5.23 19.2263 5 19.4963 5C19.7563 5 19.9663 5.19 19.9963 5.43L20.4263 8.5C20.4663 8.79 20.7063 9 20.9963 9C21.2863 9 21.5263 8.79 21.5663 8.5L21.9963 5.43C22.0263 5.19 22.2363 5 22.4963 5C22.7663 5 22.9963 5.23 22.9963 5.5C22.9963 6.32 23.6563 6.98 24.4663 7C25.3063 7.02 25.9963 6.31 25.9963 5.47V5C25.9963 3.34 24.6563 2 22.9963 2C22.2263 2 21.5263 2.32 20.9963 2.83Z" fill="#26EAFC"/>
</svg>
<svg width="610" height="216" viewBox="0 0 610 216" fill="none" xmlns="http://www.w3.org/2000/svg">
<path id="squiggle" d="M1.5 83.9777C1.5 159.985 69.5106 183.452 154.064 183.452C236.902 178.856 294.681 53.8638 209.367 83.9777C133.285 120.676 166.19 205.338 236.902 213.799C305.875 222.053 312.574 157.661 328.889 106.821C345.82 54.0581 370.867 13.7526 428.473 2.03607C473.965 -7.21664 534.556 71.326 609 20.7776" stroke="white" stroke-width="1.14771" stroke-linecap="round" stroke-dasharray="9.65 9.65"/>
</svg>
</div>
<div class="controls">
<label for="distance">offset-distance: <span id="percent">0%</span></label>
<input value="0" id="distance" min="0" max="100" type="range">
</div>
:root {
--distance: 0;
}
.container {
position: relative;
width: fit-content;
margin-inline: auto;
margin-top: 44px;
}
.item {
offset-path: url(#squiggle);
width: 38px;
height: auto;
offset-distance: var(--distance);
position: absolute;
inset: 0;
}
body {
background-color: rgb(1, 22, 25);
margin: 0;
color: white;
font-family: system-ui;
}
.controls {
display: flex;
gap: 8px;
flex-direction: column;
margin: auto;
width: 161px;
margin-top: 48px;
}
const range = document.querySelector('input[type="range"]');
const percent = document.querySelector('#percent');
range.addEventListener('input', function(event) {
percent.textContent = `${event.currentTarget.value}%`;
document.documentElement.style.setProperty('--distance', `${event.currentTarget.value}%`);
})
Also see: Tab Triggers