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.
<svg viewBox="0 0 466 421" width="800" height="800" class="wv-map" aria-hidden="true">
<defs>
<path id="wvMap" d="M202 0h-2l-4 4-1-2h-3l-2 1-2 2-1 2 1 2 3 4 2 5 1 2v4l-2 5v3h1l1 1v7l-1 4v1l-3 2-1 1-1 5-1 2-1 5-1 2-2 4-1 3v8l-1 3v1l-1 2-1 2v1l1 1v1l-1 1h-2l-1-1-1 2 1 1v2l1 1-1 1-1 3h-1l-1 2v4l-1 1-2 1-1 1 1 1 2 2v2l1 1-1 3-1 1-1 1v2l-1 3v2l-7 4-10 8-3 3-2 4-1 2-5 2-1 1-3 3-1 1-2 1h-4l-2 1-3 4h-3l-2-2-1-2-1-2v-1h-4l-2 1-7 6-1 3v4l-2 2v-1h-2v1l-1-1-2 1h-4l-2 4-4 6-1 2v8l-1 2-5 2v2h1v1l1 1 2 1v2l-1 5 1 2 1 1v2l-2 1-1-1-2-2h-2l-1 2v3l-1 2-3 1-1 2-2-1-1-2 1-1v-2h1v-1l1-1-1-1v-2l-2-2-1-2-2-1-2-1-2-1-2-1-3 3-3 4-3 4-2 4v5l-1 2-1 2-1 3-2 1-1 1-1 3 1 2v2l1 2v6l1 2v5l-1 1-3 1-4-1-2 1-1 3-2 11-1 2-1 2h-2l-7 1-8 3H9l-4-2v7l2 4v4l-1 3 1 2-1 1v1H5l-1 1v4l-1 1-1 1-1 1H0v2l1 1 7 11v1l1 1v2h1l5 5 1 2v2l-1 2h-1l1 1 4 3 1 1 1 2v2l1 3v3l7 6 1 2v2l2 5v2h1l1 1 3 1h1l1 1v1l2 3 1-1v1h1l3 3h1v2l1 1v1l1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 2-1v-2l-1-2-1-1h-2l-1 1-1 1-2-1-1 1h-1l-2 1-3-1-1-1-8-8-5-2h-6l-1 1-2 4h-2l-1 2-1 1h-2l-4-1-2 1-2 1-1 1-2-1-1 1 2 4h-3l-1 1v1l2 1v1l-1 1-3 2h-9v1l-8-1-3-1-1-1h-1l-3-3h-1l-1-1v-1l1-1h1v-1l-1-1-1-1-1-1h-1v2l-1 1-1 2-1 1v1l1 1-1 1-2 1h-1l-1 1-1 2-1 2-6 6v1h-1v1l-1 1-1-1h-2l-1-2-2-1h-2l-1-1-1 1-3 2h-1v1l-1 3v1h-1v1l-2 2-1 1h-1v1l-4 2-3 2-1 2-1 1-1 2v1h-1l-4 1h-1l-10 10h-1l-1 1h-1v-63h-12l-12 1h-74l1-8-1-9V0z"></path>
<circle id="blobCircle" cx="233" cy="210.5" r="50" />
<clipPath id="wvMapClip">
<use href="#wvMap" width="800" height="800" />
</clipPath>
<!-- Gooey blobs mask -->
<filter id="gooeyFilter">
<feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blur" />
<feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 19 -9" result="goo" />
<feComposite in="SourceGraphic" in2="goo" operator="atop" />
<feTurbulence type="turbulence" baseFrequency="0.05" numOctaves="3" result="turbulence" />
<feDisplacementMap in="SourceGraphic" in2="turbulence" scale=40 />
</filter>
<mask id="blobsMask">
<g filter="url(#gooeyFilter)" fill="white">
<use href="#blobCircle" class="wv-map__blob" />
<use href="#blobCircle" class="wv-map__blob" />
<use href="#blobCircle" class="wv-map__blob" />
<use href="#blobCircle" class="wv-map__blob" />
<use href="#blobCircle" class="wv-map__blob" />
</g>
</mask>
<!-- Grunge mask -->
<filter id="alphaFilter">
<feComponentTransfer in="SourceGraphic">
<feFuncR type="table" tableValues="0 1" />
<feFuncG type="table" tableValues="0 1" />
<feFuncB type="table" tableValues="0 1" />
<feFuncA type="identity" />
</feComponentTransfer>
</filter>
<mask id="grungeMask" x="0" y="0" width="1" height="1" maskUnits="objectBoundingBox">
<image href="https://live.staticflickr.com/65535/53120533481_5285aadd0f_h.jpg" height="100%" width="100%" preserveAspectRatio="xMaxYMid slice" filter="url(#alphaFilter)" />
</mask>
</defs>
<!-- <use href="#wvMap" class="hp-campuses-svg__stroke" /> -->
<g clip-path="url(#wvMapClip)">
<g mask="url(#blobsMask)">
<rect width="100%" height="100%" mask="url(#grungeMask)" class="wv-map__rect" />
</g>
</g>
</svg>
body {
display: grid;
place-items: center;
min-height: 100vh;
margin: 0;
}
.wv-map {
display: block;
max-width: 100%;
height: auto;
cursor: pointer;
// &__stroke {
// fill: none;
// stroke: $wvu-gold;
// stroke-width: 1;
// }
&__blob {
transform: rotate(var(--blob-rotation, 0deg)) matrix(4, 0, 0, 4, 0, var(--blob-translate, 100));
transform-origin: center center;
.animate & {
animation-name: move-blob;
animation-duration: 4s;
animation-timing-function: ease-out;
animation-fill-mode: both;
}
&:nth-child(1) {
--blob-translate: 0;
}
&:nth-child(2) {}
&:nth-child(3) {
--blob-rotation: 45deg;
}
&:nth-child(4) {
--blob-rotation: 135deg;
}
&:nth-child(5) {
--blob-rotation: 225deg;
}
}
&__rect {
fill: #9ddae6;
}
}
@keyframes move-blob {
from {
transform: rotate(var(--blob-rotation, 0deg)) matrix(0.01, 0, 0, 0.01, 0, 0);
}
}
(function () {
var map = document.querySelector(".wv-map");
map.classList.add("animate");
map.addEventListener("click", function () {
this.classList.remove("animate");
this.offsetWidth;
setTimeout(() => {
this.classList.add("animate");
}, "100");
});
})();
Also see: Tab Triggers