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.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sscaffold-css@0.1.0/sscaffold.min.css" integrity="sha256-NxJ/Enl6+QKA3ysgZq44/qc6cWmUXbAB/hl+QFBuMck=" crossorigin="anonymous">
<main>
<section id="typography">
<h1>Typography</h1>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
</section>
<section id="lists">
<h1>Lists</h1>
<ol>
<li>First ordered list item
<ul>
<li>Unordered sub-item a</li>
<li>Unordered sub-item b
<dl>
<dt>Description list item I</dt>
<dd>Description item item II</dd>
</dl>
</li>
</ul>
</li>
<li>Second ordered list item</li>
</ol>
</section>
<section id="tables">
<h1>Tables</h1>
<div class="table-container">
<table>
<thead>
<tr>
<th>Name</th>
<th>Century</th>
<th>Field</th>
</tr>
</thead>
<tbody>
<tr>
<td>Elizabeth Garrett Anderson</td>
<td>19<sup>th</sup></td>
<td>Medicine</td>
</tr>
<tr>
<td>Mary Anning</td>
<td>19<sup>th</sup></td>
<td>Paleontology</td>
</tr>
<tr>
<td>Barbara McClintock</td>
<td>20<sup>th</sup></td>
<td>Genetics</td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="blockquotes">
<h1>Blockquotes</h1>
<blockquote>
“Lorem ipsum dolor sit amet, consectetur adipiscing elit”, she said.
</blockquote>
</section>
<section id="code">
<h1>Code</h1>
<pre><code>
10 PRINT HELLO WORLD
20 GOTO 10
</code></pre>
</section>
<section id="forms">
<h1>Forms and <a href="javascript:" class="button">buttons</a></h1>
<form>
<fieldset>
<label for="nameField">Name</label>
<input type="text" placeholder="CJ Patoilo" id="nameField">
<label for="ageRangeField">Age Range</label>
<select id="ageRangeField">
<option value="0-13">0-13</option>
<option value="14-17">14-17</option>
<option value="18-23">18-23</option>
<option value="24+">24+</option>
</select>
<label for="commentField">Comment</label>
<textarea placeholder="Hi CJ …" id="commentField"></textarea>
<div class="float-right">
<input type="checkbox" id="confirmField">
<label class="inline" for="confirmField">Send a copy to yourself</label>
</div>
<input type="submit" value="Send" onclick="javascript:return false;">
</fieldset>
</form>
</section>
<section id="columns">
<h1>Flexbox columns</h1>
<div>
<div class="row">
<div class="column">.column</div>
<div class="column">.column</div>
<div class="column">.column</div>
<div class="column">.column</div>
</div>
<div class="row">
<div class="column">.column</div>
<div class="column column-50 column-offset-25">.column column-50 column-offset-25</div>
</div>
</div>
<h4>Column widths</h4>
<div>
<div class="row">
<div class="column column-10">10%</div>
</div>
<div class="row">
<div class="column column-20">20%</div>
</div>
<div class="row">
<div class="column column-25">25%</div>
</div>
<div class="row">
<div class="column column-33">33%</div>
</div>
<div class="row">
<div class="column column-40">40%</div>
</div>
<div class="row">
<div class="column column-50">50%</div>
</div>
<div class="row">
<div class="column column-60">60%</div>
</div>
<div class="row">
<div class="column column-67">67%</div>
</div>
<div class="row">
<div class="column column-70">70%</div>
</div>
<div class="row">
<div class="column column-75">75%</div>
</div>
<div class="row">
<div class="column column-80">80%</div>
</div>
<div class="row">
<div class="column column-90">90%</div>
</div>
<div class="row">
<div class="column">100%</div>
</div>
</div>
</section>
<section id="grid">
<h1>The 12-column grid</h1>
<div>
<div class="row">
<div class="one column">One</div>
<div class="eleven columns">Eleven</div>
</div>
<div class="row">
<div class="two columns">Two</div>
<div class="ten columns">Ten</div>
</div>
<div class="row">
<div class="three columns">Three</div>
<div class="nine columns">Nine</div>
</div>
<div class="row">
<div class="four columns">Four</div>
<div class="eight columns">Eight</div>
</div>
<div class="row">
<div class="five columns">Five</div>
<div class="seven columns">Seven</div>
</div>
<div class="row">
<div class="six columns">Six</div>
<div class="six columns">Six</div>
</div>
<div class="row">
<div class="seven columns">Seven</div>
<div class="five columns">Five</div>
</div>
<div class="row">
<div class="eight columns">Eight</div>
<div class="four columns">Four</div>
</div>
<div class="row">
<div class="nine columns">Nine</div>
<div class="three columns">Three</div>
</div>
<div class="row">
<div class="ten columns">Ten</div>
<div class="two columns">Two</div>
</div>
<div class="row">
<div class="eleven columns">Eleven</div>
<div class="one column">One</div>
</div>
</div>
</section>
<section id="footer">
<h1>Sticky Footer</h1>
<pre><code><body>
<header>…</header>
<main>…</main>
<footer>…</footer>
</body></code></pre>
</section>
</main>
<footer>
</footer>
#logo {
display: block;
margin: 0 auto 2.0rem auto;
margin-bottom: 4.0rem;
}
.column {
background: #d1d1d1;
border: 1px solid #efefef;
display: block;
font-size: 1rem;
font-weight: 600;
height: 3rem;
letter-spacing: .1rem;
line-height: 3rem;
margin-bottom: 2.5rem;
text-align: center;
text-transform: uppercase;
}
/* skeleton.css grid */
#grid .column,
#grid .columns {
background: #EEE;
text-align: center;
border-radius: 4px;
font-size: 1rem;
text-transform: uppercase;
height: 30px;
line-height: 30px;
margin-bottom: .75rem;
font-weight: 600;
letter-spacing: .1rem;
}
@media (min-width: 550px) {
#grid .column,
#grid .columns {
margin-bottom: 1.5rem;
}
Also see: Tab Triggers