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">
<div class="chain left"></div>
<div class="chain right"></div>
<div class="cog left">
<svg width="150px" height="150px" viewBox="0 0 42 42" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="cog" fill-rule="nonzero">
<path d="M36.601563,23.199219 C36.699219,22.5 36.800781,21.800781 36.800781,21 C36.800781,20.199219 36.699219,19.5 36.601563,18.800781 L41.101563,15.601563 C41.5,15.300781 41.699219,14.699219 41.398438,14.199219 L37,6.800781 C36.699219,6.300781 36.199219,6.101563 35.699219,6.398438 L30.699219,8.699219 C29.5,7.800781 28.300781,7.101563 26.898438,6.5 L26.398438,1 C26.300781,0.5 25.898438,0.101563 25.398438,0.101563 L16.800781,0.101563 C16.300781,0.101563 15.800781,0.5 15.800781,1 L15.300781,6.5 C13.898438,7.101563 12.601563,7.800781 11.5,8.699219 L6.5,6.398438 C6,6.199219 5.398438,6.398438 5.199219,6.800781 L0.898438,14.199219 C0.601563,14.699219 0.800781,15.300781 1.199219,15.601563 L5.699219,18.800781 C5.601563,19.5 5.5,20.199219 5.5,21 C5.5,21.800781 5.601563,22.5 5.699219,23.199219 L1,26.398438 C0.601563,26.699219 0.398438,27.300781 0.699219,27.800781 L5,35.199219 C5.300781,35.699219 5.800781,35.898438 6.300781,35.601563 L11.300781,33.300781 C12.5,34.199219 13.699219,34.898438 15.101563,35.5 L15.601563,41 C15.699219,41.5 16.101563,41.898438 16.601563,41.898438 L25.199219,41.898438 C25.699219,41.898438 26.199219,41.5 26.199219,41 L26.699219,35.5 C28.101563,34.898438 29.398438,34.199219 30.5,33.300781 L35.5,35.601563 C36,35.800781 36.601563,35.601563 36.800781,35.199219 L41.101563,27.800781 C41.398438,27.300781 41.199219,26.699219 40.800781,26.398438 L36.601563,23.199219 Z M21,31 C15.5,31 11,26.5 11,21 C11,15.5 15.5,11 21,11 C26.5,11 31,15.5 31,21 C31,26.5 26.5,31 21,31 Z" id="Shape" fill="#C7A005" class="cog-outer"></path>
<path d="M21,9 C14.398438,9 9,14.398438 9,21 C9,27.601563 14.398438,33 21,33 C27.601563,33 33,27.601563 33,21 C33,14.398438 27.601563,9 21,9 Z M21,26 C18.199219,26 16,23.800781 16,21 C16,18.199219 18.199219,16 21,16 C23.800781,16 26,18.199219 26,21 C26,23.800781 23.800781,26 21,26 Z" id="Shape" fill="#F1C40F" class="cog-inner"></path>
</g>
</g>
</svg>
</div>
<div class="cog right">
<svg width="150px" height="150px" viewBox="0 0 42 42" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="cog" fill-rule="nonzero">
<path d="M36.601563,23.199219 C36.699219,22.5 36.800781,21.800781 36.800781,21 C36.800781,20.199219 36.699219,19.5 36.601563,18.800781 L41.101563,15.601563 C41.5,15.300781 41.699219,14.699219 41.398438,14.199219 L37,6.800781 C36.699219,6.300781 36.199219,6.101563 35.699219,6.398438 L30.699219,8.699219 C29.5,7.800781 28.300781,7.101563 26.898438,6.5 L26.398438,1 C26.300781,0.5 25.898438,0.101563 25.398438,0.101563 L16.800781,0.101563 C16.300781,0.101563 15.800781,0.5 15.800781,1 L15.300781,6.5 C13.898438,7.101563 12.601563,7.800781 11.5,8.699219 L6.5,6.398438 C6,6.199219 5.398438,6.398438 5.199219,6.800781 L0.898438,14.199219 C0.601563,14.699219 0.800781,15.300781 1.199219,15.601563 L5.699219,18.800781 C5.601563,19.5 5.5,20.199219 5.5,21 C5.5,21.800781 5.601563,22.5 5.699219,23.199219 L1,26.398438 C0.601563,26.699219 0.398438,27.300781 0.699219,27.800781 L5,35.199219 C5.300781,35.699219 5.800781,35.898438 6.300781,35.601563 L11.300781,33.300781 C12.5,34.199219 13.699219,34.898438 15.101563,35.5 L15.601563,41 C15.699219,41.5 16.101563,41.898438 16.601563,41.898438 L25.199219,41.898438 C25.699219,41.898438 26.199219,41.5 26.199219,41 L26.699219,35.5 C28.101563,34.898438 29.398438,34.199219 30.5,33.300781 L35.5,35.601563 C36,35.800781 36.601563,35.601563 36.800781,35.199219 L41.101563,27.800781 C41.398438,27.300781 41.199219,26.699219 40.800781,26.398438 L36.601563,23.199219 Z M21,31 C15.5,31 11,26.5 11,21 C11,15.5 15.5,11 21,11 C26.5,11 31,15.5 31,21 C31,26.5 26.5,31 21,31 Z" id="Shape" fill="#927d0a" class="cog-outer"></path>
<path d="M21,9 C14.398438,9 9,14.398438 9,21 C9,27.601563 14.398438,33 21,33 C27.601563,33 33,27.601563 33,21 C33,14.398438 27.601563,9 21,9 Z M21,26 C18.199219,26 16,23.800781 16,21 C16,18.199219 18.199219,16 21,16 C23.800781,16 26,18.199219 26,21 C26,23.800781 23.800781,26 21,26 Z" id="Shape" fill="#F1C40F" class="cog-inner"></path>
</g>
</g>
</svg>
</div>
<div class="steam left"></div>
<div class="steam right"></div>
<div class="message animated bounceInDown">
<div class="rivet top-left"></div>
<div class="rivet top-right"></div>
<div class="rivet bottom-left"></div>
<div class="rivet bottom-right"></div>
<div class="message-inner">
<h1 class="message-title">Access <br />Forbidden</h1>
<p class="message-subtitle">Error code 403</p>
</div>
</div>
</div>
@page-background-color: #282820;
@message-background-color: #825301;
@message-border-color: #b1811d;
@message-width: 432px;
@message-height: 324px;
@message-inner-offset: 2%;
@message-box-shadow: #471f05;
@rivet-color: #8f6002;
@text-color: #291b03;
@cog-offset: -50px;
@cog-outer-color: #955112;
@cog-inner-color: #633d03;
@chain-width: 50px;
@chain-background: url(https://i.postimg.cc/0QbqNZYv/chain-4.png) repeat-y
center;
.cog-animation(@name) {
animation: @name 1.8s ease-in-out;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
body {
font-family: "Sancreek", cursive;
}
.container {
position: relative;
height: 100vh;
overflow: hidden;
background: @page-background-color;
z-index: -1;
}
.message {
text-align: center;
position: absolute;
left: 0;
right: 0;
z-index: 1;
top: 150px;
width: @message-width;
height: @message-height;
margin: 0 auto;
border: 20px solid @message-border-color;
background: @message-border-color;
border-radius: 20px;
box-shadow: 0px 0px 0px 4px @message-box-shadow;
animation-delay: 1s;
animation-duration: 1.3s;
&::before,
&::after {
content: "";
position: absolute;
bottom: 107%;
width: @chain-width;
height: 300px;
background: @chain-background;
z-index: -10;
}
&::before {
left: 20px;
}
&::after {
right: 20px;
}
}
.message-inner {
padding: 40px;
border-radius: 20px;
position: absolute;
top: @message-inner-offset;
right: @message-inner-offset;
bottom: @message-inner-offset;
left: @message-inner-offset;
color: @text-color;
background: @message-background-color;
}
.message-title {
font-size: 4em;
margin: 0 0 20px;
}
.message-subtitle {
font-size: 2em;
margin: 0;
}
.chain {
position: absolute;
top: 0;
height: 200%;
width: @chain-width;
background: @chain-background;
.cog-animation(chain);
&.left {
left: 0;
}
&.right {
right: 0;
}
}
.cog {
position: absolute;
bottom: @cog-offset;
&.left {
left: @cog-offset;
.cog-animation(cog-spin-left);
}
&.right {
right: @cog-offset;
.cog-animation(cog-spin-right);
}
}
.cog-outer {
fill: @cog-outer-color;
}
.cog-inner {
fill: @cog-inner-color;
}
.rivet {
position: absolute;
background-color: #8f6002;
width: 3%;
border-radius: 100px;
padding-bottom: 3%;
&.top-left {
top: -7px;
left: -7px;
}
&.top-right {
top: -7px;
right: -7px;
}
&.bottom-left {
bottom: -7px;
left: -7px;
}
&.bottom-right {
bottom: -7px;
right: -7px;
}
}
@keyframes cog-spin-left {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@keyframes cog-spin-right {
from {
transform: rotate(0deg);
}
to {
transform: rotate(-360deg);
}
}
@keyframes chain {
from {
top: 0;
}
to {
top: -100%;
}
}
Also see: Tab Triggers