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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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">
<div class="guy__box">
</div>
</div>
$background: orange;
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: $background;
}
.container {
position: relative;
height: 325px;
display: flex;
justify-content: center;
align-items: center;
}
.guy {
position: relative;
fill: rgba(0, 0, 0, 0);
opacity: 0;
&__box {
height: 199px;
width: 74px;
position: relative;
background: rgba(50, 50, 50, .5);
// -webkit-mask-image:
// mask: no-repeat 50% 50%;
-webkit-mask: url('data:image/svg+xml;utf8,<svg class="guy" viewBox="0 0 74 199" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"
x="0px" y="0px" width="74px" height="199px"
>
<g>
<path fill="orange" d="M 36.0343 0 C 44.9963 0 52.2616 7.2693 52.2616 16.2366 C 52.2616 25.2036 44.9963 32.4729 36.0343 32.4729 C 27.0723 32.4729 19.8071 25.2036 19.8071 16.2366 C 19.8071 7.2693 27.0723 0 36.0343 0 Z" />
<path class="guy" fill="#E0EBD3" d="M 16.8497 189.8979 C 16.8497 194.9209 20.9269 199 25.9468 199 C 30.9767 199 35.0479 194.9209 35.0479 189.8979 L 35.0558 113.5334 L 39.1072 113.5334 L 39.0813 189.8979 C 39.0813 194.9209 43.1545 199 48.1783 199 C 53.2023 199 57.2734 194.9209 57.2734 189.8979 L 57.3132 58.2434 L 61.303 58.2434 L 61.303 106.7595 C 61.303 116.5205 74.0276 116.5205 73.9999 106.7595 L 73.9999 57.2087 C 73.9999 46.4268 67.6674 35.8599 55.0598 35.8599 L 18.6874 35.8438 C 7.1978 35.8438 0 45.2168 0 56.9121 L 0 106.7615 C 0 116.4507 12.7944 116.4507 12.7944 106.7615 L 12.7944 58.2454 L 16.8676 58.2454 L 16.8497 189.8979 Z" />
</g>
</svg>') no-repeat 50% 50%;
&:after {
position: absolute;
content: " ";
bottom: 0;
// height: 150px;
width: 100%;
background: yellow;
// z-index: 50;
animation: fill .9s ease forwards;
}
}
}
@keyframes fill {
0% { height: 0; }
100% { height: 50%; }
}
Also see: Tab Triggers