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>
<a id="skip-to-content" href="#main-container" class="visually-hidden">skip to main content</a>
<span class="cool-logo">
<a href="#">Cool Logo</a>
</span>
<nav role="navigation">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
<a href="#">Link 4</a>
<a href="#">Link 5</a>
<a href="#">Link 6</a>
<a href="#">Link 7</a>
</nav>
</header>
<main id="main-container" tabindex="-1">
<h1>Main Content</h1>
<p>Lorem ipsum dolor sit amet, consectetur <a href="#">adipisicing</a> elit. Nisi aliquid repudiandae corrupti nam vel reiciendis nesciunt assumenda ea suscipit ducimus numquam dignissimos consequatur provident. Necessitatibus laboriosam commodi <a href="#">reprehenderit dolores</a> eum molestiae quidem in possimus perferendis soluta? Nesciunt nam ad tempore debitis molestias deserunt explicabo obcaecati maxime impedit excepturi pariatur tenetur quisquam rerum odio similique. Rem tempora eveniet possimus repellat culpa voluptatibus porro ad quidem rerum doloremque obcaecati blanditiis fugiat provident perferendis inventore pariatur explicabo itaque illum aperiam nihil nulla labore repudiandae mollitia sint aspernatur nostrum impedit. Corporis accusantium natus sint eum ex saepe optio ab ratione ut placeat obcaecati iure. Repellendus iste fuga impedit perferendis architecto fugit deleniti fugiat magnam et quas facilis quis dolore harum aut nostrum dolorem accusamus perspiciatis nemo laboriosam quisquam. Ex voluptatibus beatae tempore tempora veritatis nobis porro commodi in non alias harum illo quos esse molestias assumenda ipsa quaerat sapiente nisi iste ea a aut odit accusantium repellat dolor perspiciatis eos recusandae officiis ducimus velit expedita deserunt at odio placeat corporis aliquid numquam quae libero dolores omnis! Dolor aliquam odio fugit quas id a accusantium animi veniam tempore blanditiis excepturi dolore? Quibusdam maxime voluptatem perferendis illum doloribus sapiente inventore aut repellat nulla earum excepturi obcaecati quas voluptatibus nostrum accusamus libero ab voluptate ratione voluptas quo fugit rerum dolores quis. Possimus perferendis consequatur nemo dolores porro voluptates modi deserunt temporibus rem veniam deleniti accusamus laborum voluptatum doloribus provident magni rerum veritatis ducimus earum atque nesciunt quasi voluptatem error saepe ut dignissimos sunt. Vero doloribus molestias laborum vel excepturi doloremque quam sunt impedit voluptatum dolorum. Eaque dicta unde totam porro hic facilis voluptatibus dolor nisi aut beatae sint aliquid adipisci aliquam perferendis ab autem velit necessitatibus ducimus error temporibus asperiores natus dolorem consectetur cupiditate alias. Ab excepturi iusto aut aspernatur accusantium ratione eveniet laborum nulla debitis incidunt. Illum voluptatum quas ut magni iusto ratione fugiat natus aut velit quaerat modi quibusdam laudantium accusantium dolore provident enim officia voluptatem illo culpa assumenda excepturi est pariatur distinctio neque quasi ab voluptate itaque ullam quae deleniti libero id at labore iure facilis quo a eum! Aliquid unde fugit ut voluptates natus laborum nostrum cumque laboriosam labore dolore hic deserunt magnam harum doloremque aliquam voluptas totam itaque quaerat officia dicta a nisi asperiores quod eos corporis fugiat illum quae esse ad error? Dolorum non possimus fugit libero ex voluptas enim officiis magni consequatur natus quod neque laboriosam mollitia est accusantium earum deleniti error placeat alias excepturi expedita sapiente incidunt exercitationem maiores nesciunt nulla atque! Unde pariatur laudantium explicabo itaque minima molestias optio necessitatibus quas expedita nobis. Iure ea esse sequi provident et pariatur unde excepturi voluptates autem ex incidunt magnam quasi natus laborum perspiciatis perferendis blanditiis aspernatur aliquid accusamus veniam quod illum quo fugiat vel ipsum est voluptatum aliquam corporis quaerat earum fuga dolor mollitia modi quia totam doloremque debitis. Nostrum ea veniam ut voluptatum beatae fugit eveniet non magni velit molestias a laudantium ex repellat numquam consequuntur eligendi mollitia? Fuga cum quia dolorum porro quis quasi eveniet adipisci a autem.</p>
</main>
<footer>
<p>© Lorem Ispum | Lorem Lorem</p>
</footer>
.visually-hidden:not(:focus):not(:active) {
clip: rect(0 0 0 0);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}
#skip-to-content {
padding: 1em;
position: absolute;
top: 0;
left: 1em;
z-index: 1000;
background: #222;
color: white;
}
.cool-logo {
font-size: 3em;
margin-bottom:.5em;
display: block;
a { color: #222; }
}
/* Demo Layout */
header,
main, footer {
width: 80%;
margin: 0 auto;
}
// open full page - tab into interface
// visually hidden class tnx Scott! https://www.scottohara.me/blog/2017/04/14/inclusively-hidden.html#hiding-content-visually
Also see: Tab Triggers