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.
<header>
<h1>Header</h1>
</header>
<nav>
<h1>Nav</h1>
</nav>
<main>
<h1>Main</h1>
</main>
<aside>
<h1>Aside</h1>
</aside>
<footer>
<h1>Footer</h1>
</footer>
@import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 100vw;
min-height: 100vh;
font-family: "Exo", Arial, sans-serif;
background-color: #f7f7f7;
}
body > * {
display: flex;
justify-content: center;
align-items: center;
color: #fff;
}
header {
box-shadow: inset 0 0 0 2px lime;
}
nav {
box-shadow: inset 0 0 0 2px blue;
}
aside {
box-shadow: inset 0 0 0 2px #000;
}
footer {
box-shadow: inset 0 0 0 2px red;
}
header {
background-image: radial-gradient(
circle at 69% 3%,
rgba(255, 255, 255, 0.04) 0%,
rgba(255, 255, 255, 0.04) 8%,
transparent 8%,
transparent 92%
),
radial-gradient(
circle at 85% 72%,
rgba(255, 255, 255, 0.04) 0%,
rgba(255, 255, 255, 0.04) 8%,
transparent 8%,
transparent 92%
),
radial-gradient(
circle at 43% 49%,
rgba(255, 255, 255, 0.03) 0%,
rgba(255, 255, 255, 0.03) 6%,
transparent 6%,
transparent 94%
),
radial-gradient(
circle at 12% 98%,
rgba(255, 255, 255, 0.03) 0%,
rgba(255, 255, 255, 0.03) 6%,
transparent 6%,
transparent 94%
),
radial-gradient(
circle at 37% 52%,
rgba(255, 255, 255, 0.03) 0%,
rgba(255, 255, 255, 0.03) 6%,
transparent 6%,
transparent 94%
),
radial-gradient(
circle at 22% 59%,
rgba(255, 255, 255, 0.03) 0%,
rgba(255, 255, 255, 0.03) 6%,
transparent 6%,
transparent 94%
),
radial-gradient(
circle at 25% 56%,
rgba(255, 255, 255, 0.04) 0%,
rgba(255, 255, 255, 0.04) 4%,
transparent 4%,
transparent 96%
),
radial-gradient(
circle at 22% 79%,
rgba(255, 255, 255, 0.04) 0%,
rgba(255, 255, 255, 0.04) 4%,
transparent 4%,
transparent 96%
),
radial-gradient(
circle at 80% 81%,
rgba(255, 255, 255, 0.04) 0%,
rgba(255, 255, 255, 0.04) 4%,
transparent 4%,
transparent 96%
),
radial-gradient(
circle at 52% 16%,
rgba(255, 255, 255, 0.04) 0%,
rgba(255, 255, 255, 0.04) 4%,
transparent 4%,
transparent 96%
),
linear-gradient(135deg, rgb(205, 220, 48), rgb(224, 17, 25));
}
nav {
background-image: radial-gradient(
circle at 48% 33%,
rgba(255, 255, 255, 0.04) 0%,
rgba(255, 255, 255, 0.04) 8%,
transparent 8%,
transparent 92%
),
radial-gradient(
circle at 28% 16%,
rgba(255, 255, 255, 0.04) 0%,
rgba(255, 255, 255, 0.04) 8%,
transparent 8%,
transparent 92%
),
radial-gradient(
circle at 34% 52%,
rgba(255, 255, 255, 0.03) 0%,
rgba(255, 255, 255, 0.03) 6%,
transparent 6%,
transparent 94%
),
radial-gradient(
circle at 92% 52%,
rgba(255, 255, 255, 0.03) 0%,
rgba(255, 255, 255, 0.03) 6%,
transparent 6%,
transparent 94%
),
radial-gradient(
circle at 77% 84%,
rgba(255, 255, 255, 0.03) 0%,
rgba(255, 255, 255, 0.03) 6%,
transparent 6%,
transparent 94%
),
radial-gradient(
circle at 75% 64%,
rgba(255, 255, 255, 0.03) 0%,
rgba(255, 255, 255, 0.03) 6%,
transparent 6%,
transparent 94%
),
radial-gradient(
circle at 70% 62%,
rgba(255, 255, 255, 0.04) 0%,
rgba(255, 255, 255, 0.04) 4%,
transparent 4%,
transparent 96%
),
radial-gradient(
circle at 55% 100%,
rgba(255, 255, 255, 0.04) 0%,
rgba(255, 255, 255, 0.04) 4%,
transparent 4%,
transparent 96%
),
radial-gradient(
circle at 12% 11%,
rgba(255, 255, 255, 0.04) 0%,
rgba(255, 255, 255, 0.04) 4%,
transparent 4%,
transparent 96%
),
radial-gradient(
circle at 35% 55%,
rgba(255, 255, 255, 0.04) 0%,
rgba(255, 255, 255, 0.04) 4%,
transparent 4%,
transparent 96%
),
linear-gradient(45deg, rgb(26, 21, 192), rgb(171, 83, 239));
}
aside {
background-image: radial-gradient(
circle at 33% 89%,
rgba(0, 0, 0, 0.01) 0%,
rgba(0, 0, 0, 0.01) 2%,
transparent 2%,
transparent 100%
),
radial-gradient(
circle at 46% 10%,
rgba(0, 0, 0, 0.02) 0%,
rgba(0, 0, 0, 0.02) 2%,
transparent 2%,
transparent 100%
),
radial-gradient(
circle at 50% 24%,
rgba(0, 0, 0, 0.03) 0%,
rgba(0, 0, 0, 0.03) 8%,
transparent 8%,
transparent 100%
),
radial-gradient(
circle at 74% 80%,
rgba(0, 0, 0, 0.03) 0%,
rgba(0, 0, 0, 0.03) 8%,
transparent 8%,
transparent 100%
),
radial-gradient(
circle at 43% 65%,
rgba(0, 0, 0, 0.02) 0%,
rgba(0, 0, 0, 0.02) 8%,
transparent 8%,
transparent 100%
),
radial-gradient(
circle at 72% 54%,
rgba(0, 0, 0, 0.03) 0%,
rgba(0, 0, 0, 0.03) 8%,
transparent 8%,
transparent 100%
),
radial-gradient(
circle at 51% 78%,
rgba(0, 0, 0, 0.03) 0%,
rgba(0, 0, 0, 0.03) 5%,
transparent 5%,
transparent 100%
),
radial-gradient(
circle at 81% 59%,
rgba(0, 0, 0, 0.03) 0%,
rgba(0, 0, 0, 0.03) 5%,
transparent 5%,
transparent 100%
),
radial-gradient(
circle at 62% 56%,
rgba(0, 0, 0, 0.01) 0%,
rgba(0, 0, 0, 0.01) 5%,
transparent 5%,
transparent 100%
),
linear-gradient(0deg, rgb(55, 192, 164), rgb(215, 206, 58));
}
main {
background-image: radial-gradient(
circle at 69% 3%,
rgba(21, 214, 212, 0.04) 0%,
rgba(21, 214, 212, 0.04) 8%,
transparent 8%,
transparent 92%
),
radial-gradient(
circle at 85% 72%,
rgba(21, 214, 212, 0.04) 0%,
rgba(21, 214, 212, 0.04) 8%,
transparent 8%,
transparent 92%
),
radial-gradient(
circle at 43% 49%,
rgba(113, 32, 32, 0.03) 0%,
rgba(113, 32, 32, 0.03) 6%,
transparent 6%,
transparent 94%
),
radial-gradient(
circle at 12% 98%,
rgba(113, 32, 32, 0.03) 0%,
rgba(113, 32, 32, 0.03) 6%,
transparent 6%,
transparent 94%
),
radial-gradient(
circle at 37% 52%,
rgba(113, 32, 32, 0.03) 0%,
rgba(113, 32, 32, 0.03) 6%,
transparent 6%,
transparent 94%
),
radial-gradient(
circle at 22% 59%,
rgba(113, 32, 32, 0.03) 0%,
rgba(113, 32, 32, 0.03) 6%,
transparent 6%,
transparent 94%
),
radial-gradient(
circle at 25% 56%,
rgba(21, 214, 212, 0.04) 0%,
rgba(21, 214, 212, 0.04) 4%,
transparent 4%,
transparent 96%
),
radial-gradient(
circle at 22% 79%,
rgba(21, 214, 212, 0.04) 0%,
rgba(21, 214, 212, 0.04) 4%,
transparent 4%,
transparent 96%
),
radial-gradient(
circle at 80% 81%,
rgba(21, 214, 212, 0.04) 0%,
rgba(21, 214, 212, 0.04) 4%,
transparent 4%,
transparent 96%
),
radial-gradient(
circle at 52% 16%,
rgba(21, 214, 212, 0.04) 0%,
rgba(21, 214, 212, 0.04) 4%,
transparent 4%,
transparent 96%
),
linear-gradient(341deg, rgb(109, 19, 27), rgb(16, 12, 12));
}
footer {
background-image: radial-gradient(
circle at 43% 39%,
rgba(0, 0, 0, 0.02) 0%,
rgba(0, 0, 0, 0.02) 2%,
transparent 2%,
transparent 100%
),
radial-gradient(
circle at 71% 44%,
rgba(0, 0, 0, 0.02) 0%,
rgba(0, 0, 0, 0.02) 2%,
transparent 2%,
transparent 100%
),
radial-gradient(
circle at 50% 74%,
rgba(78, 243, 192, 0.03) 0%,
rgba(78, 243, 192, 0.03) 8%,
transparent 8%,
transparent 100%
),
radial-gradient(
circle at 34% 20%,
rgba(78, 243, 192, 0.03) 0%,
rgba(78, 243, 192, 0.03) 8%,
transparent 8%,
transparent 100%
),
radial-gradient(
circle at 44% 59%,
rgba(0, 0, 0, 0.01) 0%,
rgba(0, 0, 0, 0.01) 8%,
transparent 8%,
transparent 100%
),
radial-gradient(
circle at 6% 48%,
rgba(0, 0, 0, 0.02) 0%,
rgba(0, 0, 0, 0.02) 5%,
transparent 5%,
transparent 100%
),
radial-gradient(
circle at 94% 15%,
rgba(78, 243, 192, 0.03) 0%,
rgba(78, 243, 192, 0.03) 5%,
transparent 5%,
transparent 100%
),
radial-gradient(
circle at 81% 40%,
rgba(78, 243, 192, 0.03) 0%,
rgba(78, 243, 192, 0.03) 5%,
transparent 5%,
transparent 100%
),
radial-gradient(
circle at 7% 68%,
rgba(78, 243, 192, 0.03) 0%,
rgba(78, 243, 192, 0.03) 5%,
transparent 5%,
transparent 100%
),
radial-gradient(
circle at 10% 37%,
rgba(0, 0, 0, 0.01) 0%,
rgba(0, 0, 0, 0.01) 5%,
transparent 5%,
transparent 100%
),
linear-gradient(377deg, rgb(72, 213, 196), rgb(27, 247, 175));
}
body {
display: grid;
grid-template-columns: 220px 1fr 220px;
grid-template-rows: min-content auto min-content;
gap: 20px;
}
header {
grid-row: 1;
grid-column: 1 / span 3;
z-index: 1;
}
nav {
grid-column: 1;
grid-row: 1 / span 3;
}
aside {
grid-column: 3;
grid-row: 1 / span 3;
}
footer {
grid-row: 3;
grid-column: 1 / span 3;
z-index: 1;
}
Also see: Tab Triggers