Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

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.

+ add another resource


Add Packages

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.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <p style="margin-bottom: 1000px;">Please scroll down. The image is below the viewport.</p>
<p style="margin-bottom: 1000px;">Way to go&hellip;</p>

<h4>Lazy cat loaded lazily</h4>
<p>If your browser supports native lazy-loading, it loads the first 2 kB of the image in order to display a placeholder. Then, it loads the full-size image.</p>
<p>If your browser does not support native lazy-loading, it loads the lazysizes library and sets the <code>img</code>'s <code>src</code> to a low-quality image placeholder, which is also around 2 kB in size. Then, it loads the full-size image.</p>
<div class="alert alert-warning">The native lazy-loading's 2 kB range request do not work from within Codepen. However, you can make this work by copying this to an empty HTML file on your computer.</div>
<img data-src="" data-lqip="" loading="lazy" alt="Lazy cat loaded lazily">

  const images = document.querySelectorAll("img[loading='lazy']")
  if ("loading" in HTMLImageElement.prototype) {
    // native lazy-loading supported
    for (const image of images) {
      image.src = image.dataset.src
  } else {
    // native lazy-loading not supported
    // dynamically load the lazysizes library
    for (const image of images) {
      // request the low-quality image placeholder
      image.src = image.dataset.lqip
      // enable lazy-loading when user scrolls image into view or browser is idle