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 493 470", fill="none", xmlns="http://www.w3.org/2000/svg")
circle.pupil(cx="301.377", cy="120.203", r="25", fill="black")
circle.pupil(cx="410.549", cy="120.203", r="25", fill="black")
path(
fill-rule="evenodd",
clip-rule="evenodd",
d="M259.889 15.0499V70.8143H259.876V221.295L258.4 221.295H256.925V221.306C204.644 222.094 162.506 264.721 162.506 317.189C162.506 317.682 162.51 318.174 162.517 318.664H162.506L162.506 432.262C108.996 416.323 97.8602 285.614 97.5813 232.691C97.589 232.336 97.5928 231.979 97.5928 231.622C97.5928 231.19 97.5872 230.759 97.576 230.33C97.5769 229.247 97.5827 228.202 97.5928 227.196L97.3926 227.176C95.1473 202.372 74.2973 182.937 48.908 182.937C23.6523 182.937 2.88829 202.168 0.460371 226.785C0.379264 226.92 0.300188 227.057 0.223163 227.196C-5.67803 379.447 106.937 458.326 162.506 469.145L397.078 469.145L398.554 469.145V469.134C450.834 468.345 492.973 425.719 492.973 373.25C492.973 372.983 492.972 372.716 492.969 372.449C492.969 372.36 492.968 372.272 492.967 372.183C492.965 372.047 492.964 371.911 492.962 371.775H492.973V221.295V71.4081H492.986V15.3468C493.478 7.47851 480.594 -5.89754 466.431 3.54437C452.416 12.8874 421.837 51.8923 407.857 70.8143H345.238C331.36 52.0065 300.533 12.6397 286.445 3.24749C272.282 -6.19442 259.397 7.18163 259.889 15.0499ZM360.21 152.253C360.21 174.252 342.376 192.086 320.377 192.086C298.377 192.086 280.543 174.252 280.543 152.253C280.543 130.253 298.377 112.42 320.377 112.42C342.376 112.42 360.21 130.253 360.21 152.253ZM429.549 192.086C451.548 192.086 469.382 174.252 469.382 152.253C469.382 130.253 451.548 112.42 429.549 112.42C407.549 112.42 389.716 130.253 389.716 152.253C389.716 174.252 407.549 192.086 429.549 192.086Z",
fill="#232323"
)
path(
fill-rule="evenodd",
clip-rule="evenodd",
d="M377.899 191.671C384.633 191.124 389.702 188.743 389.702 185.888C389.702 182.628 383.097 179.986 374.949 179.986C366.801 179.986 360.196 182.628 360.196 185.888C360.196 188.743 365.264 191.124 371.998 191.671V206.542H366.097C364.468 206.542 363.146 207.863 363.146 209.492C363.146 211.122 364.468 212.443 366.097 212.443H366.1H383.797H383.801C385.43 212.443 386.751 211.122 386.751 209.492C386.751 207.863 385.43 206.542 383.801 206.542H377.899V191.671Z",
fill="#FACCFB"
)
* {
box-sizing: border-box;
}
:root {
--size: 150;
--unit: calc((var(--size) / 470) * 1vmin);
}
$black: #232222;
body {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: #ffefef;
}
svg {
position: fixed;
bottom: 0%;
width: calc(100 * var(--unit));
height: calc(100 * var(--unit));
}
const pupil = document.getElementsByClassName("pupil");
document.onmousemove = () => {
const x = `${(event.clientX * 6) / window.innerWidth}%`;
const y = `${(event.clientY * 8) / window.innerHeight}%`;
for (let i = 0; i < 2; i++) {
pupil[i].style.left = x;
pupil[i].style.top = y;
pupil[i].style.transform = `translate(${x},${y})`;
}
};
Also see: Tab Triggers