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.
<div class="reading-progress"></div>
<h1 id="title">Lore Ipsum</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Posuere urna nec tincidunt praesent semper feugiat nibh. Consectetur a erat nam at lectus urna duis. Aliquam purus sit amet luctus. Integer enim neque volutpat ac tincidunt vitae semper quis lectus. Varius morbi enim nunc faucibus a. Eget lorem dolor sed viverra. Massa massa ultricies mi quis hendrerit dolor. Fermentum odio eu feugiat pretium nibh ipsum consequat nisl vel. Dignissim diam quis enim lobortis scelerisque fermentum dui faucibus.</p>
<p>Viverra suspendisse potenti nullam ac tortor vitae purus. Purus sit amet volutpat consequat mauris nunc congue nisi vitae. Quam pellentesque nec nam aliquam sem. Neque ornare aenean euismod elementum. At quis risus sed vulputate odio. Euismod lacinia at quis risus sed vulputate odio ut. Mattis vulputate enim nulla aliquet. Quisque sagittis purus sit amet volutpat. Auctor urna nunc id cursus metus aliquam eleifend mi. Fusce id velit ut tortor pretium viverra suspendisse. Duis ut diam quam nulla porttitor massa. Sit amet tellus cras adipiscing enim eu turpis egestas. Cras sed felis eget velit aliquet sagittis. Libero enim sed faucibus turpis in eu. Est lorem ipsum dolor sit amet. Turpis egestas maecenas pharetra convallis posuere morbi leo. Ut tellus elementum sagittis vitae et leo duis.</p>
<p>Porta lorem mollis aliquam ut porttitor leo a. Sed faucibus turpis in eu mi bibendum neque egestas. Sed viverra tellus in hac habitasse platea dictumst vestibulum rhoncus. Eget sit amet tellus cras adipiscing enim. Vulputate sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum. Leo vel orci porta non pulvinar neque laoreet suspendisse. Et egestas quis ipsum suspendisse ultrices gravida dictum. Lectus arcu bibendum at varius vel. Enim praesent elementum facilisis leo vel fringilla est ullamcorper. Egestas dui id ornare arcu odio ut sem nulla.</p>
<p>Eget aliquet nibh praesent tristique magna sit amet purus. Volutpat odio facilisis mauris sit. Viverra suspendisse potenti nullam ac. Ut ornare lectus sit amet est placerat in egestas. Dolor magna eget est lorem ipsum dolor sit. Iaculis urna id volutpat lacus. Mi tempus imperdiet nulla malesuada pellentesque. Ipsum nunc aliquet bibendum enim facilisis gravida neque convallis. Posuere lorem ipsum dolor sit amet consectetur adipiscing. Quis commodo odio aenean sed. Sed cras ornare arcu dui vivamus arcu felis bibendum. Dis parturient montes nascetur ridiculus mus mauris vitae ultricies. Id volutpat lacus laoreet non curabitur gravida arcu.</p>
<p>Arcu vitae elementum curabitur vitae nunc sed. Egestas diam in arcu cursus. Egestas pretium aenean pharetra magna ac placerat vestibulum. Massa tincidunt dui ut ornare lectus sit amet est placerat. Pellentesque habitant morbi tristique senectus et netus. Arcu odio ut sem nulla pharetra diam. Dictum at tempor commodo ullamcorper a. Praesent semper feugiat nibh sed pulvinar. Porttitor lacus luctus accumsan tortor. Iaculis nunc sed augue lacus viverra. Sed cras ornare arcu dui vivamus arcu. Nunc pulvinar sapien et ligula ullamcorper malesuada. Potenti nullam ac tortor vitae purus. Et netus et malesuada fames. Volutpat sed cras ornare arcu.</p>
<p>In fermentum posuere urna nec tincidunt. Pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat vivamus at. Proin sed libero enim sed faucibus turpis in eu. Sit amet consectetur adipiscing elit ut aliquam purus sit amet. Senectus et netus et malesuada fames ac. Non nisi est sit amet facilisis. Venenatis lectus magna fringilla urna porttitor rhoncus dolor. Blandit aliquam etiam erat velit scelerisque in dictum non. At varius vel pharetra vel turpis. Amet consectetur adipiscing elit duis tristique sollicitudin nibh.</p>
<p>Neque convallis a cras semper auctor neque vitae tempus quam. Adipiscing bibendum est ultricies integer quis auctor elit sed. Vel risus commodo viverra maecenas accumsan lacus vel facilisis volutpat. Egestas diam in arcu cursus euismod. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Quis auctor elit sed vulputate mi sit amet. Ullamcorper dignissim cras tincidunt lobortis feugiat vivamus. Commodo sed egestas egestas fringilla phasellus faucibus scelerisque eleifend. At tellus at urna condimentum mattis pellentesque. Nec dui nunc mattis enim ut. Aliquet lectus proin nibh nisl condimentum id.</p>
<p>Vel pretium lectus quam id leo in vitae turpis. Venenatis cras sed felis eget velit aliquet sagittis. Arcu cursus vitae congue mauris rhoncus aenean vel elit scelerisque. Mauris commodo quis imperdiet massa tincidunt nunc pulvinar sapien. Pellentesque habitant morbi tristique senectus et. Etiam sit amet nisl purus in mollis nunc sed id. Nascetur ridiculus mus mauris vitae ultricies leo. Praesent elementum facilisis leo vel fringilla est ullamcorper eget nulla. Volutpat maecenas volutpat blandit aliquam etiam erat velit. Lectus sit amet est placerat in. Imperdiet proin fermentum leo vel orci porta. Platea dictumst quisque sagittis purus sit amet volutpat. Diam maecenas ultricies mi eget mauris pharetra et. Sagittis purus sit amet volutpat consequat. At risus viverra adipiscing at in tellus integer feugiat scelerisque. Duis at consectetur lorem donec massa sapien faucibus et molestie. Quis commodo odio aenean sed adipiscing.</p>
<p>Vitae nunc sed velit dignissim sodales ut eu sem integer. Sapien et ligula ullamcorper malesuada proin libero nunc consequat interdum. Facilisis magna etiam tempor orci eu lobortis elementum nibh tellus. Leo vel fringilla est ullamcorper eget. Lacus luctus accumsan tortor posuere ac ut consequat semper viverra. Sit amet risus nullam eget felis eget nunc. Vulputate dignissim suspendisse in est ante. Sagittis nisl rhoncus mattis rhoncus urna. Eu scelerisque felis imperdiet proin fermentum leo vel orci. Consequat nisl vel pretium lectus quam id leo in vitae. Convallis tellus id interdum velit laoreet id donec ultrices tincidunt. Varius duis at consectetur lorem donec. Tristique senectus et netus et malesuada fames ac turpis. Placerat in egestas erat imperdiet. A iaculis at erat pellentesque adipiscing commodo. Aliquam malesuada bibendum arcu vitae elementum curabitur vitae nunc. Consectetur libero id faucibus nisl tincidunt eget nullam non nisi. Est placerat in egestas erat imperdiet sed euismod.</p>
<p>Blandit volutpat maecenas volutpat blandit aliquam. Habitant morbi tristique senectus et netus et malesuada fames. Justo nec ultrices dui sapien. Et tortor at risus viverra adipiscing at. Auctor augue mauris augue neque gravida in fermentum. Scelerisque purus semper eget duis at tellus at urna. Maecenas volutpat blandit aliquam etiam erat velit. Volutpat diam ut venenatis tellus in metus. Convallis aenean et tortor at risus. Blandit aliquam etiam erat velit scelerisque in. Vulputate enim nulla aliquet porttitor lacus luctus accumsan. Id leo in vitae turpis. Mauris pharetra et ultrices neque ornare aenean euismod elementum. Ullamcorper eget nulla facilisi etiam dignissim diam quis.</p>
<p><a href="#title">Back to top</a></p>
@layer demo;
@layer reading-indicator;
@layer reading-indicator {
html {
position: relative;
}
.reading-progress {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: calc(100% - 100vh);
z-index: -1;
overflow: hidden;
}
.reading-progress::before,
.reading-progress::after {
content: "";
top: 0;
left: -0.5%;
width: 101%;
}
.reading-progress::after {
position: absolute;
height: 100%;
background: linear-gradient(to bottom left, #fff 50%, #fff0 50%);
}
.reading-progress::before {
position: fixed;
height: 10px;
background: linear-gradient(90deg, #369, #396);
}
}
@layer demo {
html {
font-family: Helvetica, Arial, sans-serif;
scroll-behavior: smooth;
}
p {
font-size: 1.5rem;
line-height: 1.5;
max-width: 60ch;
}
}
Also see: Tab Triggers