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 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.
<h3>Lorem ipsum dolor sit amet</h3>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc neque tortor, condimentum vel feugiat sit amet, pretium in erat. Interdum et malesuada fames ac ante ipsum primis in faucibus. Morbi a fermentum felis. Nulla aliquet lacus leo, non ultricies dui elementum at. Nullam pulvinar efficitur est, pulvinar tempus lacus cursus nec. Duis sapien leo, lobortis at ligula sit amet, scelerisque suscipit arcu. Donec molestie sapien at consequat dignissim.<br/>
<br/>
<div id="btn-cm">
<div id="btn_toc" onclick="if (document.getElementById('toc').style.display === 'none') { document.getElementById('toc').style.display = 'block'; } else { document.getElementById('toc').style.display = 'none'; }" role="button" tabindex="0">Contents <svg width="18" height="18" viewBox="0 0 24 24"><path fill="#000000" d="M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z" /></svg></div>
<div id="toc">
<ol>
<li><a href="#toc_1" title="Cras ac justo at nibh ullamcorper efficitur">Cras ac justo at nibh ullamcorper efficitur</a></li>
<li><a href="#toc_2" title="Aenean nec sodales sapien">Aenean nec sodales sapien</a></li>
<li><a href="#toc_3" title="Praesent rhoncus eleifend augue">Praesent rhoncus eleifend augue</a></li>
<li><a href="#toc_4" title="Vivamus dictum quis felis eget hendrerit">Vivamus dictum quis felis eget hendrerit</a></li>
<li><a href="#toc_5" title="Curabitur sed euismod mauris">Curabitur sed euismod mauris</a></li>
</ol>
</div>
</div>
<br/>
Proin fermentum, dolor in lacinia pretium, turpis lorem aliquet tortor, interdum molestie tortor lacus ut mauris. Duis eu iaculis sapien. Nam sodales felis ut massa maximus, eu hendrerit elit lacinia. Maecenas dapibus dolor lorem, tempus tristique sapien ultrices et. Ut nec quam vitae elit consectetur rutrum id non metus. Morbi vitae turpis et mi sollicitudin dictum. Sed vel mauris dictum, semper lacus finibus, tristique eros. Pellentesque eget neque ut arcu eleifend fringilla ut sed nisi.<br/>
<br/>
In sed venenatis mauris. Praesent commodo tincidunt massa, id vehicula erat hendrerit sed. Vestibulum quis maximus sapien. Nunc ut semper sapien. Nam consectetur dui eget augue pretium lacinia. Praesent tempor nunc et leo rutrum, nec finibus eros pellentesque. Donec id porttitor quam, sed aliquet quam. Duis lobortis lorem ac lorem eleifend tempus. Donec posuere posuere ante. Donec in dui justo. Integer vel ex molestie, commodo elit ac, suscipit ex. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Duis euismod at enim ullamcorper aliquam. Aliquam posuere condimentum tortor, vel luctus diam tincidunt vel. Sed posuere, nulla id elementum dapibus, neque ex efficitur ex, vitae elementum velit elit ultricies metus. Vivamus a congue tortor, eget finibus magna.<br/>
<br/>
<h3 id="toc_1">Cras ac justo at nibh ullamcorper efficitur</h3>
Suspendisse potenti. Cras ac justo at nibh ullamcorper efficitur. Ut in enim sit amet justo auctor rhoncus ut a lorem. Sed accumsan purus a velit vehicula dignissim. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut pellentesque justo eget molestie aliquet. Vestibulum vel nisl luctus, volutpat purus non, pharetra neque.<br/>
<br/>
Aliquam pharetra ex nec risus dictum, id dictum tortor interdum. Fusce mattis congue nisl ac pellentesque. Proin tempor elit ac volutpat sagittis. Maecenas suscipit tincidunt risus ut commodo. Aliquam turpis nulla, volutpat sit amet consequat nec, luctus nec neque. Ut malesuada vestibulum diam id pellentesque. Vestibulum a ex vel est eleifend fermentum. Ut posuere placerat pretium. Maecenas varius elit sed velit eleifend, quis finibus est finibus. Fusce accumsan a massa sit amet ultrices. Fusce lorem nibh, consequat quis scelerisque non, dictum eget orci. Aliquam venenatis ligula sapien, sed vulputate ligula semper non. Praesent laoreet velit a arcu dictum placerat.<br/>
<br/>
<div class="back_toc" onclick="document.getElementById('btn_toc').scrollIntoView(true);" role="button" tabindex="0">Back to Content ↑</div>
<h3 id="toc_2">Aenean nec sodales sapien</h3>
Suspendisse potenti. Aenean nec sodales sapien, nec molestie nulla. Sed malesuada massa neque, nec rhoncus nunc placerat a. Mauris interdum nunc sit amet ligula bibendum, ut placerat metus vehicula. Cras sodales eros vitae dolor luctus, facilisis scelerisque lacus tincidunt. Mauris vel porttitor sem. Nullam dignissim, leo quis cursus tincidunt, velit mauris pellentesque libero, ut dictum erat ipsum aliquet justo. Nunc ultrices cursus scelerisque. Mauris nec semper enim. Maecenas rutrum velit in libero porta sagittis in nec lorem. Phasellus molestie turpis id quam vulputate volutpat.<br/>
<br/>
Donec quis purus ipsum. Suspendisse eu quam eleifend, maximus eros in, eleifend erat. Etiam blandit eros eget ornare malesuada. Phasellus ultricies, lorem id vestibulum scelerisque, ligula risus scelerisque purus, quis dictum nisl urna tristique libero. Donec eu vulputate sem. Maecenas sed mi dapibus, venenatis ligula et, scelerisque massa. Praesent accumsan varius dui, a porttitor lorem dignissim eget. Phasellus sagittis tellus non odio condimentum, in finibus arcu auctor. Suspendisse mattis enim vitae sem porttitor pretium. Nam ornare hendrerit vulputate.<br/>
<br/>
<div class="back_toc" onclick="document.getElementById('btn_toc').scrollIntoView(true);" role="button" tabindex="0">Back to Content ↑</div>
<h3 id="toc_3">Praesent rhoncus eleifend augue</h3>
Praesent rhoncus eleifend augue, non pellentesque neque tincidunt eu. Suspendisse lobortis magna vel consequat ultrices. Fusce dapibus sapien nec lacus mattis lacinia. Praesent interdum velit id porta molestie. Vestibulum vel magna auctor, lobortis dui vitae, semper mi. Donec dignissim purus sit amet nunc condimentum, viverra finibus orci rhoncus. Integer pretium vulputate neque, ac hendrerit dolor gravida vel. Maecenas volutpat eleifend nulla. Mauris a velit sodales, hendrerit arcu vitae, maximus magna. Ut in eros rhoncus, dignissim erat eu, feugiat mi. Nunc et tellus dignissim, lobortis quam vel, lacinia mi. Aenean lacus ex, fringilla eget lacus ac, tempor sollicitudin libero.<br/>
<br/>
Maecenas metus lacus, blandit porta enim eget, vestibulum laoreet magna. Nam imperdiet viverra urna, eget pharetra erat viverra blandit. Donec sed lorem sit amet leo dapibus malesuada. Sed tempus leo vitae nunc tincidunt varius. Etiam non pellentesque elit. Integer turpis quam, porta nec egestas a, posuere ac sapien. Pellentesque at turpis nec sem fringilla maximus. Sed egestas dolor eu finibus tincidunt. Donec molestie quam elit, ullamcorper ornare odio mattis sit amet. Duis aliquam aliquet interdum.<br/>
<br/>
<div class="back_toc" onclick="document.getElementById('btn_toc').scrollIntoView(true);" role="button" tabindex="0">Back to Content ↑</div>
<h3 id="toc_4">Vivamus dictum quis felis eget hendrerit</h3>
Maecenas sollicitudin velit eu pulvinar laoreet. Quisque nec dolor vel nisl facilisis condimentum. Vivamus dictum quis felis eget hendrerit. Nullam blandit tellus in sagittis sollicitudin. Nulla porta elit eget quam tincidunt ultrices. Donec convallis velit sed consequat efficitur. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Pellentesque vel sapien ac leo dictum pellentesque id eget turpis. Pellentesque facilisis, eros at egestas efficitur, nulla diam euismod eros, eu tempus elit nisi id urna. In eu arcu vel quam feugiat dignissim ut in mauris. Sed ac ipsum quis nibh imperdiet dignissim. Quisque a nisl quis justo finibus ornare ac sit amet erat. Praesent semper varius sem, sed laoreet mi maximus id. Ut volutpat feugiat mollis.<br/>
<br/>
Etiam ac urna eu massa dictum egestas vitae non lorem. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras ornare lorem vitae nisi pretium, vel vulputate ipsum imperdiet. Etiam id diam massa. Vivamus laoreet tortor et metus interdum commodo. Maecenas efficitur aliquet aliquam. Vivamus varius nibh et ligula sagittis, sit amet aliquam ligula pretium. Curabitur in maximus leo, et gravida dolor. Sed vitae auctor purus. Suspendisse ut gravida elit, vitae maximus orci.<br/>
<br/>
<div class="back_toc" onclick="document.getElementById('btn_toc').scrollIntoView(true);" role="button" tabindex="0">Back to Content ↑</div>
<h3 id="toc_5">Curabitur sed euismod mauris</h3>
Curabitur sed euismod mauris, ut tempus ante. Sed tincidunt metus accumsan pellentesque hendrerit. Mauris tellus magna, viverra vitae congue id, commodo non felis. Proin eget fringilla neque. Morbi mauris nunc, imperdiet venenatis elit vitae, sodales finibus sapien. In vestibulum et mauris et varius. Integer in purus mauris. Duis placerat auctor ex at efficitur. Duis facilisis aliquet sapien, euismod efficitur diam auctor eu. Nullam in luctus magna, eu tristique ex. Mauris quis justo vehicula, sollicitudin ante eget, eleifend dolor. Nunc scelerisque tortor tortor, sed ultrices leo pharetra eu. Aenean imperdiet magna nisl, in porttitor nisi lacinia sit amet. Integer pharetra ligula eget placerat vestibulum. Sed ex libero, pulvinar in mollis eget, ultricies nec ipsum.<br/>
<br/>
Mauris blandit ipsum ac ligula porta feugiat. Nam dolor turpis, ultrices vel rutrum sit amet, mattis sed turpis. Nullam mi risus, tempus ut orci congue, scelerisque suscipit lorem. Maecenas ornare neque libero, vel tempus libero elementum ut. Vivamus cursus enim in risus fringilla laoreet. In in erat volutpat, dignissim ipsum ornare, pretium mi. Maecenas non dui tempor, fringilla neque eu, hendrerit velit. Curabitur semper ac felis et cursus.<br/>
<div class="back_toc" onclick="document.getElementById('btn_toc').scrollIntoView(true);" role="button" tabindex="0">Back to Content ↑</div>
/* Table of Contents (TOC) */
#btn-cm{border:1px solid #dadada;border-radius:5px;background-color:#f9f9f9}
#btn_toc{font-weight:700;cursor:pointer;margin:10px}
#btn_toc:focus,#toc li:focus,.back_toc:focus{outline:none}
#btn_toc svg{vertical-align:middle}
#toc li{cursor:pointer}
#toc{display:grid}
.back_toc{cursor:pointer;text-align:right}
:target::before{content:"";display:block;height:40px;margin-top:-40px;visibility:hidden}
Also see: Tab Triggers