Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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


Save Automatically?

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.


  <!-- widescreen image for wide viewports -->
  <!-- LQIP goes in the srcset; full quality images go in the data-srcset -->
    srcset=",f_png,ar_16:9/w_16,q_auto/wikipedia-photos/016 16w"
    data-srcset=",ar_16:9/w_500,f_auto,q_auto/wikipedia-photos/016 500w,
       ,ar_16:9/w_1000,f_auto,q_auto/wikipedia-photos/016 1000w,
       ,ar_16:9/w_1500,f_auto,q_auto/wikipedia-photos/016 1500w"
    media="(min-width: 600px)"
  <!-- square-cropped image for narrow viewports -->
    srcset=",ar_1/w_16,f_png,q_auto/wikipedia-photos/016 16w"
    data-srcset=",ar_1/w_500,f_auto,q_auto/wikipedia-photos/016 500w,
       ,ar_1/w_1000,f_auto,q_auto/wikipedia-photos/016 1000w,
       ,ar_1/w_1500,f_auto,q_auto/wikipedia-photos/016 1500w"



                img {
  /* the one thing you'll probably want is an extrinsic size on the img, to make sure that the LQIP is always scaled up properly */
  width: 50vw;

/* none of the rest is necessary; just makes the demo a little nicer to look at */
  image-rendering: pixelated;

body {
  background: #110;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;


                // swap out the LQIP with the full-quality image in javascript
// there are a bunch of different ways that you could/would-want-to do this... here, I've super-delayed the image load, which you would never want to do in production, but it makes sure that you can *see* the LQIP, for demo purposes

const delay = 4000; // milliseconds
const imgsAndSources = [ ...document.querySelectorAll( 'img, source' ) ];
const timer = setTimeout( () => {
  imgsAndSources.forEach( ( el ) => {
    el.setAttribute( 'srcset', el.getAttribute( 'data-srcset' ) );
  } )
}, delay );