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 URL's 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 it's URL and the proper URL extention.
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.
<main>
<header>Hello</header>
<nav><ul><li>item</li><li>item</li><li>item</li><li>item</li></ul></nav>
<h1 class="page-header"><span>Maybe this is a separate bit</span>this is the heading and it is quite long and continues to write into this area of the heading.</h1>
<section> <p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nec blandit nulla. Pellentesque magna nisl, malesuada ut vestibulum quis, vehicula sit amet nisi. Duis pulvinar ipsum at sollicitudin fermentum. Morbi ullamcorper quam sodales enim condimentum, tincidunt laoreet felis efficitur. Maecenas ac diam non nibh bibendum tincidunt ut a nisi. Proin lobortis augue sed posuere iaculis. In id fringilla ipsum. Aliquam erat volutpat. Aliquam erat volutpat. Nulla condimentum enim a mauris finibus mollis. Mauris orci arcu, ultrices non fermentum at, convallis vitae urna. Nunc vulputate lorem in ante hendrerit, malesuada tristique felis sollicitudin. Nunc quis est a libero tincidunt iaculis in in sem. Donec sapien velit, viverra in egestas eu, blandit ac nulla.
</p>
<p>
Proin facilisis a magna eget scelerisque. Maecenas sed mauris ut dolor interdum lacinia. Proin a facilisis leo, in porttitor neque. Praesent vel tortor id lacus placerat commodo. Cras vulputate maximus porttitor. Maecenas vitae sem ut ex consequat pulvinar eget ac eros. Aenean massa lorem, suscipit pulvinar vulputate nec, rutrum ut ante. Interdum et malesuada fames ac ante ipsum primis in faucibus. Ut maximus bibendum velit ut laoreet. Nullam blandit tempor purus in accumsan. Nullam in leo odio. Mauris malesuada velit at tortor sollicitudin tristique. Suspendisse eget varius libero. Nullam id massa quam.
</p>
<p>
Curabitur congue, odio in aliquet fermentum, ligula ligula feugiat risus, quis pharetra leo diam vel leo. Pellentesque dui neque, porta id efficitur sed, rutrum id purus. Nulla facilisi. Vivamus lobortis auctor urna, quis cursus massa auctor vel. Nam non dui eu nisl ultricies ultricies. In mattis est et diam sagittis fringilla. Aliquam facilisis cursus sollicitudin. Praesent sed risus urna. Duis vehicula consectetur sem quis molestie. Integer condimentum sed augue vitae dapibus. Quisque sodales condimentum ligula, vel bibendum lorem feugiat at. Cras laoreet, dolor sit amet malesuada dignissim, tellus dui tempus ligula, volutpat sodales justo neque vel lacus. Vivamus mauris odio, pellentesque eu pulvinar ut, sodales sit amet elit. Phasellus dolor mi, condimentum a rhoncus non, tempor ut lacus. Duis sed metus et lorem sodales pretium.
</p>
<p>
Phasellus lobortis et justo eu sodales. Nulla tempor quam ac erat consequat ornare. Aenean facilisis eros turpis, id ultricies massa mattis id. Nunc quis libero quis enim iaculis facilisis. Mauris euismod tellus nec imperdiet placerat. Fusce id luctus eros, vehicula lobortis enim. Suspendisse id velit lacus. Mauris at interdum elit. Aliquam non tincidunt arcu, nec eleifend tellus. Donec ac massa mauris. Mauris tempor augue ut enim rhoncus molestie. Cras non ligula viverra, rhoncus mauris id, convallis neque. Sed consequat tempor dui, sed blandit magna. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sed vehicula velit, eu gravida velit. Nulla nisl urna, pulvinar tincidunt mattis eu, auctor vitae lacus.
</p></section>
<footer>footer</footer>
</main>
body {font-family:rubik, 'helvetica neue', sans-serif; line-height:1.45;}
p {margin: 0;padding: 0;}
p+p {text-indent: 1em;}
$standardgrid: 1fr 1fr 1fr 1fr 1fr 1fr;
$gutter: 10px;
main {
display: grid;
grid-template-columns: $standardgrid;
grid-template-rows: auto;
grid-template-areas: "header header header header header header"
"nav nav nav nav nav nav"
"pg-header pg-header section section section ."
"footer footer footer footer footer footer";
grid-column-gap: $gutter;
grid-row-gap: $gutter;
max-width: 1000px;
margin: 3em auto;
}
@mixin createsubgrid($grid,$thisgutter) {
display: grid;
grid-template-columns: $grid;
grid-template-rows: auto;
grid-column-gap: $thisgutter;
grid-row-gap: $thisgutter;
}
header {
grid-area: header;
border-top:1px solid #222;
padding-top: 10px;
padding-bottom: 30px; font-weight:bold;
}
nav {
grid-area: nav;
border-top:1px solid #ddd;
padding: 10px 0;
}
h1.page-header {grid-area:pg-header; line-height:1.2;}
h1.page-header span {display:block; text-transform:uppercase; font-size: 0.5em; font-weight:normal; color: #555; margin-bottom: 10px;}
nav ul {
@include createsubgrid($standardgrid, $gutter);
grid-auto-flow: row;
margin: 0;
padding: 0;
list-style-type: none;
}
section {
grid-area: section;
padding: 30px 0;
}
footer {
grid-area: footer;
margin-top: 30px;
padding-top: 10px; border-top:1px solid #ddd;
}
Also see: Tab Triggers