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="vh-100 flex justify-center items-center">
<svg class="db w-100 mw7"
viewBox="0 0 400 222"
fill="none">
<rect width="400"
height="222"
fill="white" />
<path d="M0 26L45.5 0L91 26L45.5 52L0 26Z"
transform="translate(293 156)"
fill="white" />
<path d="M0 26L45.5 0L91 26L45.5 52L0 26Z"
transform="translate(293 156)"
stroke="#00011F"
stroke-width="2"
stroke-linejoin="round" />
<path d="M0 26L45.5 0L91 26L45.5 52L0 26Z"
transform="translate(293 148)"
fill="white" />
<path d="M0 26L45.5 0L91 26L45.5 52L0 26Z"
transform="translate(293 148)"
stroke="#00011F"
stroke-width="2"
stroke-linejoin="round" />
<path d="M45.5 26V34L0 8V0L45.5 26Z"
transform="translate(293 174)"
fill="white" />
<path d="M45.5 34V26L0 0V8L45.5 34Z"
transform="translate(293 174)"
stroke="#00011F"
stroke-width="2"
stroke-linecap="square"
stroke-linejoin="round" />
<path d="M0 26V34L45.5 8V0L0 26Z"
transform="translate(338.5 174)"
fill="#00011F" />
<path d="M0 34V26L45.5 0V8L0 34Z"
transform="translate(338.5 174)"
stroke="#00011F"
stroke-width="2"
stroke-linejoin="round" />
<ellipse cx="20"
cy="14.1421"
rx="20"
ry="14.1421"
transform="translate(318.5 160)"
stroke="#00011F"
stroke-width="2" />
<mask id="mask0"
mask-type="alpha"
maskUnits="userSpaceOnUse"
x="318"
y="160"
width="41"
height="29">
<ellipse cx="20"
cy="14.1421"
rx="20"
ry="14.1421"
transform="translate(318.5 160)"
fill="white" />
</mask>
<g mask="url(#mask0)">
<ellipse cx="20"
cy="14.1421"
rx="20"
ry="14.1421"
transform="translate(318.5 172)"
fill="#00011F" />
</g>
<path d="M0 96V0L96 96H0Z"
transform="translate(16 92)"
fill="#473BE7" />
<path d="M0 0V96H96L0 0Z"
transform="translate(16 92)"
stroke="#473BE7"
stroke-width="2"
stroke-linejoin="round" />
<path id="speed"
d="M96 8 C 89 8 87.5 0 80 0 C 73 0 71 8 64 8 C 57 8 55 0 48 0 C 41 0 39 8 32 8 C 25 8 23 0 16 0 C 9 0 7 8 0 8"
transform="translate(251 172) rotate(-180)"
stroke-dashoffset="110.20603942871094px"
stroke-dasharray="110.20603942871094"
stroke="#00011F"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round" />
<!-- d="M0 8C7 8 9 0 16 0C23 0 25 8 32 8C39 8 41 0 48 0C55 0 57 8 64 8C71 8 73 0 80 0C87.5 0 89 8 96 8" -->
<path id="speed-reverse"
d="M96 8 C 89 8 87.5 0 80 0 C 73 0 71 8 64 8 C 57 8 55 0 48 0 C 41 0 39 8 32 8 C 25 8 23 0 16 0 C 9 0 7 8 0 8"
transform="translate(251 172) rotate(-180)"
stroke-dashoffset="110.20603942871094px"
stroke-dasharray="110.20603942871094"
stroke="#fff"
stroke-width="3"
stroke-linecap="round"
stroke-linejoin="round" />
<!-- -93 -87 transform="translate(108 147)" -->
<g id="ball"
transform="translate(209.5 0)">
<circle cx="20"
cy="20"
r="20"
transform="translate(109 148)"
fill="white"
stroke="#00011F"
stroke-width="2" />
<path transform="translate(117 157)"
fill="#00011F"
d="M0 26.9911C3.37048 29.5776 7.5882 31.115 12.165 31.115C23.2108 31.115 32.165 22.1607 32.165 11.115C32.165 7.00189 30.9235 3.17877 28.7946 0C26.5829 14.4384 14.7213 25.6989 0 26.9911Z"
/>
</g>
<mask id="mask1"
mask-type="alpha"
maskUnits="userSpaceOnUse"
x="292"
y="112"
width="100"
height="77">
<path transform="translate(292 112.5)"
fill="#00011F"
d="M46.5 75.7843C57.5457 75.7843 66.5 69.4526 66.5 61.6421H100V0H0V61.6421H26.5C26.5 69.4526 35.4543 75.7843 46.5 75.7843Z"
/>
</mask>
<g mask="url(#mask1)"
id="hole-ball">
<path id="hole-ball-fill"
transform="translate(318.5 148)"
fill="white"
d="M40 20C40 31.0457 31.0457 40 20 40C8.9543 40 0 31.0457 0 20C0 8.9543 8.9543 0 20 0C31.0457 0 40 8.9543 40 20Z"
/>
<path id="hole-ball-shadow"
fill-rule="evenodd"
clip-rule="evenodd"
transform="translate(317.5 147)"
fill="#00011F"
d="M2 21C2 10.5066 10.5066 2 21 2C28.0696 2 34.2375 5.86116 37.5097 11.5897C34.7996 24.7784 23.9749 35.0064 10.4829 36.8262C5.36939 33.4213 2 27.6041 2 21ZM21 0C9.40202 0 0 9.40202 0 21C0 32.598 9.40202 42 21 42C32.598 42 42 32.598 42 21C42 9.40202 32.598 0 21 0Z"
/>
</g>
</svg>
</div>
const myTimeline = anime.timeline({
loop: true,
// autoplay: false,
});
myTimeline
.add({
targets: '#ball',
translateX: [
{ value: -93, duration: 1 },
{ value: -93 },
{ value: -6 },
{ value: 209.5, easing: 'easeOutExpo', duration: 800 },
],
translateY: [
{ value: -190, duration: 1 },
{ value: -87 },
{ value: 0 },
{ value: 0, easing: 'easeOutExpo', duration: 800 },
],
easing: 'easeInCubic',
})
.add({
targets: '#speed',
strokeDashoffset: [anime.setDashoffset, 0],
easing: 'linear',
duration: 100,
offset: '-=765',
})
.add({
targets: '#speed-reverse',
strokeDashoffset: [anime.setDashoffset, 0],
easing: 'linear',
duration: 300,
offset: '-=200',
})
.add({
targets: '#ball',
translateX: -93,
translateY: -190,
duration: 1,
})
.add({
targets: '#ball',
translateX: -93,
translateY: -190,
duration: 1,
})
.add({
targets: '#hole-ball',
opacity: [0, 1],
duration: 1,
})
.add({
targets: '#hole-ball-fill',
translateX: [318.5, 318.5],
translateY: [148, 148 + 64],
easing: 'easeInCubic',
duration: 800,
})
.add({
offset: '-=800',
targets: '#hole-ball-shadow',
translateX: [317.5, 317.5],
translateY: [147, 147 + 64],
easing: 'easeInCubic',
duration: 800,
});
Also see: Tab Triggers