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.
<article>
<header>
<h1>Why Donuts Are the Best Snack: An Essay</h1>
</header>
<section>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Sed debitis repellendus sit nemo molestiae porro illo esse excepturi veritatis, quod odit eum, incidunt facere dolores? Excepturi sit iste asperiores nam!</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In eu lacinia ante, eget ornare nulla. Sed et ipsum ultricies, ultricies elit pharetra, blandit tellus. Nam elementum viverra mi. Nullam pellentesque lacus sit amet felis volutpat, blandit maximus felis volutpat. In hac habitasse platea dictumst. Aliquam consequat tempor congue. In ac ex ac libero ultrices venenatis.
</p>
<p>
Morbi euismod commodo ligula ac pulvinar. Proin finibus lorem enim, eu iaculis dui consequat ac. Nullam quis tincidunt ex, et congue magna. Morbi laoreet purus arcu, at eleifend dolor auctor nec. Aenean ac sollicitudin massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Proin quis luctus augue, in dapibus sapien. Mauris suscipit nulla vitae metus euismod consectetur. Donec mi diam, ullamcorper sed lorem ac, semper placerat eros. Etiam at iaculis nulla. Nam sapien quam, sagittis at accumsan vel, egestas non odio.
</p>
<p>
Vivamus nec viverra lorem. Curabitur ac diam velit. Vestibulum faucibus, sapien in pharetra varius, mi nunc varius erat, eu molestie libero dolor ac magna. Phasellus semper turpis orci, sit amet accumsan leo luctus a. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Praesent blandit id sapien et posuere. Curabitur fringilla iaculis mauris, eget rutrum augue fringilla id. Morbi sollicitudin lacus libero, sed consequat diam aliquam non. Ut sed libero sem. Etiam luctus aliquam maximus. Morbi ultrices consequat lectus non efficitur. Curabitur maximus, metus at ultrices varius, tellus velit aliquet nunc, at ultrices dui odio a ipsum. Cras dolor turpis, tristique in neque nec, aliquet feugiat lorem.
</p>
<p>
Sed non aliquam nulla. Suspendisse potenti. Donec finibus risus elementum mi condimentum viverra. Morbi maximus consectetur nisi sed rutrum. Praesent blandit ex in iaculis vulputate. Integer varius semper fringilla. Etiam nec gravida urna. Suspendisse potenti. Sed felis magna, sollicitudin a lectus nec, auctor ultricies ex.
</p>
<p>
Maecenas vel luctus leo, a varius magna. Integer dolor tellus, accumsan ac interdum in, fringilla sit amet nisl. Nulla posuere pulvinar massa, eget vehicula nisl hendrerit non. Aenean porta lacus est. Sed et ipsum id eros rhoncus commodo. Quisque sollicitudin varius tellus in blandit. Pellentesque ullamcorper tortor erat, eu mattis ante vehicula vel. Aliquam ut finibus sapien. Cras fringilla placerat ante. Maecenas vel volutpat tellus. Maecenas ante diam, gravida vel ante non, eleifend congue odio. Morbi in erat quis ipsum suscipit feugiat. Nulla feugiat lectus sed velit egestas congue. Mauris pellentesque velit orci, vitae aliquet dui sodales facilisis. Curabitur id augue sem.
</p>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Sed debitis repellendus sit nemo molestiae porro illo esse excepturi veritatis, quod odit eum, incidunt facere dolores? Excepturi sit iste asperiores nam!</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In eu lacinia ante, eget ornare nulla. Sed et ipsum ultricies, ultricies elit pharetra, blandit tellus. Nam elementum viverra mi. Nullam pellentesque lacus sit amet felis volutpat, blandit maximus felis volutpat. In hac habitasse platea dictumst. Aliquam consequat tempor congue. In ac ex ac libero ultrices venenatis.
</p>
<p>
Morbi euismod commodo ligula ac pulvinar. Proin finibus lorem enim, eu iaculis dui consequat ac. Nullam quis tincidunt ex, et congue magna. Morbi laoreet purus arcu, at eleifend dolor auctor nec. Aenean ac sollicitudin massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Proin quis luctus augue, in dapibus sapien. Mauris suscipit nulla vitae metus euismod consectetur. Donec mi diam, ullamcorper sed lorem ac, semper placerat eros. Etiam at iaculis nulla. Nam sapien quam, sagittis at accumsan vel, egestas non odio.
</p>
<p>
Vivamus nec viverra lorem. Curabitur ac diam velit. Vestibulum faucibus, sapien in pharetra varius, mi nunc varius erat, eu molestie libero dolor ac magna. Phasellus semper turpis orci, sit amet accumsan leo luctus a. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Praesent blandit id sapien et posuere. Curabitur fringilla iaculis mauris, eget rutrum augue fringilla id. Morbi sollicitudin lacus libero, sed consequat diam aliquam non. Ut sed libero sem. Etiam luctus aliquam maximus. Morbi ultrices consequat lectus non efficitur. Curabitur maximus, metus at ultrices varius, tellus velit aliquet nunc, at ultrices dui odio a ipsum. Cras dolor turpis, tristique in neque nec, aliquet feugiat lorem.
</p>
<p>
Sed non aliquam nulla. Suspendisse potenti. Donec finibus risus elementum mi condimentum viverra. Morbi maximus consectetur nisi sed rutrum. Praesent blandit ex in iaculis vulputate. Integer varius semper fringilla. Etiam nec gravida urna. Suspendisse potenti. Sed felis magna, sollicitudin a lectus nec, auctor ultricies ex.
</p>
<p>
Maecenas vel luctus leo, a varius magna. Integer dolor tellus, accumsan ac interdum in, fringilla sit amet nisl. Nulla posuere pulvinar massa, eget vehicula nisl hendrerit non. Aenean porta lacus est. Sed et ipsum id eros rhoncus commodo. Quisque sollicitudin varius tellus in blandit. Pellentesque ullamcorper tortor erat, eu mattis ante vehicula vel. Aliquam ut finibus sapien. Cras fringilla placerat ante. Maecenas vel volutpat tellus. Maecenas ante diam, gravida vel ante non, eleifend congue odio. Morbi in erat quis ipsum suscipit feugiat. Nulla feugiat lectus sed velit egestas congue. Mauris pellentesque velit orci, vitae aliquet dui sodales facilisis. Curabitur id augue sem.
</p>
</section>
</article>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
margin: 0;
}
header {
animation: header-scroll linear forwards;
animation-timeline: scroll();
animation-range: 0vh 90vh;
background-image: url(https://images.unsplash.com/photo-1604287094096-59a7dee979e1?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2532&q=80);
background-size: cover;
background-position: center;
display: grid;
place-content: center;
position: fixed;
top: 0;
height: 100vh;
overflow: hidden;
& h1 {
background-color: hsl(0 0% 100% / 0.75);
font-size: 3rem;
width: 100vw;
text-align: center;
padding: 2rem;
}
}
@keyframes header-scroll {
to {
height: 10vh;
}
}
section {
margin: 100vh auto 2rem;
padding: 2rem;
width: 54ch;
}
Also see: Tab Triggers