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.
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSS Grid Layout - a flexible 960 grid</title>
</head>
<body>
<h1 class="title">Flexible 960 Grid</h1>
<div class="wrapper">
<div class="box grid1">01</div>
<div class="box grid2">02</div>
<div class="box grid3">03</div>
<div class="box grid4">04</div>
<div class="box grid5">05</div>
<div class="box grid6">06</div>
<div class="box grid7">07</div>
<div class="box grid8">08</div>
<div class="box grid9">09</div>
<div class="box grid10">10</div>
<div class="box grid11">11</div>
<div class="box grid12">12</div>
<div class="box grid13">13</div>
<div class="box grid14">14</div>
<div class="box grid15">15</div>
<div class="box grid16">16</div>
<div class="box row2 colspan2 grid1">01</div>
<div class="box row2 colspan2 grid3">02</div>
<div class="box row2 colspan2 grid5">03</div>
<div class="box row2 colspan2 grid7">04</div>
<div class="box row2 colspan2 grid9">05</div>
<div class="box row2 colspan2 grid11">06</div>
<div class="box row2 colspan2 grid13">07</div>
<div class="box row2 colspan2 grid15">08</div>
<div class="box row3 colspan3 grid1">01</div>
<div class="box row3 colspan3 grid4">02</div>
<div class="box row3 colspan3 grid7">03</div>
<div class="box row3 colspan3 grid10">04</div>
<div class="box row3 colspan4 grid13">05</div>
<div class="box row4 colspan4 grid1">01</div>
<div class="box row4 colspan4 grid5">02</div>
<div class="box row4 colspan4 grid9">03</div>
<div class="box row4 colspan4 grid13">04</div>
<div class="box row5 colspan5 grid1">01</div>
<div class="box row5 colspan5 grid6">02</div>
<div class="box row5 colspan6 grid11">03</div>
<div class="box row6 colspan6 grid1">01</div>
<div class="box row6 colspan5 grid7">02</div>
<div class="box row6 colspan5 grid12">03</div>
<div class="box row7 colspan7 grid1">01</div>
<div class="box row7 colspan5 grid8">02</div>
<div class="box row7 colspan4 grid13">03</div>
<div class="box row8 colspan8 grid1">01</div>
<div class="box row8 colspan8 grid9">02</div>
<div class="box grid1 row9">01</div>
<div class="box grid2 row10">02</div>
<div class="box grid3 row11">03</div>
<div class="box grid4 row12">04</div>
<div class="box grid5 row13">05</div>
<div class="box grid6 row14">06</div>
<div class="box grid7 row15">07</div>
<div class="box grid8 row16">08</div>
<div class="box grid9 row17">09</div>
<div class="box grid10 row18">10</div>
<div class="box grid11 row19">11</div>
<div class="box grid12 row20">12</div>
<div class="box grid13 row21">13</div>
<div class="box grid14 row22">14</div>
<div class="box grid15 row23">15</div>
<div class="box grid16 row24">16</div>
</div>
</body>
</html>
body {
margin: 0;
padding: 20px;
background-color: #999;
color: #fff;
background-image: url("http://media.24ways.org/2012/andrew/otis_redding.png");
font: 87.5%/1.4 HelveticaNeue, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
h1, h2, h3, h4, h5, h6 {
font-family: "Georgia","Times New Roman",serif;
font-weight: normal;
padding: 0;
margin: 0;
}
h1 {
font-size: 328.571%;
margin-bottom: 0.2em;
}
h1.title {
text-align: center;
text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}
h2 {
font-size: 250%;
margin-bottom: 0.2em;
}
h3 {
font-size: 150%;
margin-bottom: 0.2em;
}
p {
margin:0;
padding: 0 0 1em 0;
}
.box {
background-color: #ddd;
padding: 10px 10px 1px;
color: #444;
}
.wrapper {
width: 90%;
margin: 0 auto 0 auto;
display: -ms-grid;
-ms-grid-columns: 1fr (4.25fr 1fr)[16];
-ms-grid-rows: (auto 20px)[24];
}
.grid1 {-ms-grid-column: 2;}
.grid2 {-ms-grid-column: 4;}
.grid3 {-ms-grid-column: 6;}
.grid4 {-ms-grid-column: 8;}
.grid5 {-ms-grid-column: 10;}
.grid6 {-ms-grid-column: 12;}
.grid7 {-ms-grid-column: 14;}
.grid8 {-ms-grid-column: 16;}
.grid9 {-ms-grid-column: 18;}
.grid10 {-ms-grid-column: 20;}
.grid11 {-ms-grid-column: 22;}
.grid12 {-ms-grid-column: 24;}
.grid13 {-ms-grid-column: 26;}
.grid14 {-ms-grid-column: 28;}
.grid15 {-ms-grid-column: 30;}
.grid16 {-ms-grid-column: 32;}
.row1 {-ms-grid-row:1;}
.row2 {-ms-grid-row:3;}
.row3 {-ms-grid-row:5;}
.row4 {-ms-grid-row:7;}
.row5 {-ms-grid-row:9;}
.row6 {-ms-grid-row:11;}
.row7 {-ms-grid-row:13;}
.row8 {-ms-grid-row:15;}
.row9 {-ms-grid-row:17;}
.row10 {-ms-grid-row:19;}
.row11 {-ms-grid-row:21;}
.row12 {-ms-grid-row:23;}
.row13 {-ms-grid-row:25;}
.row14 {-ms-grid-row:27;}
.row15 {-ms-grid-row:29;}
.row16 {-ms-grid-row:31;}
.row17 {-ms-grid-row:33;}
.row18 {-ms-grid-row:35;}
.row19 {-ms-grid-row:37;}
.row20 {-ms-grid-row:39;}
.row21 {-ms-grid-row:41;}
.row22 {-ms-grid-row:43;}
.row23 {-ms-grid-row:45;}
.row24 {-ms-grid-row:47;}
.colspan1 {-ms-grid-column-span:1;}
.colspan2 {-ms-grid-column-span:3;}
.colspan3 {-ms-grid-column-span:5;}
.colspan4 {-ms-grid-column-span:7;}
.colspan5 {-ms-grid-column-span:9;}
.colspan6 {-ms-grid-column-span:11;}
.colspan7 {-ms-grid-column-span:13;}
.colspan8 {-ms-grid-column-span:15;}
.colspan9 {-ms-grid-column-span:17;}
.colspan10 {-ms-grid-column-span:19;}
.colspan11 {-ms-grid-column-span:21;}
.colspan12 {-ms-grid-column-span:23;}
.colspan13 {-ms-grid-column-span:25;}
.colspan14 {-ms-grid-column-span:27;}
.colspan15 {-ms-grid-column-span:29;}
.colspan16 {-ms-grid-column-span:31;}
Also see: Tab Triggers