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.


                <!-- Check out head settings by clicking the cog icon next to the HTML window -->

<body class="no-js">
    <button onClick="loadFontCSS()">
  Load Font CSS - initiate font file download
    Font: <span id="js-font-status">not loaded</span>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec dapibus pulvinar nulla. Proin vitae ex vitae eros ultricies placerat. Vivamus consectetur ultrices vulputate. Curabitur sit amet scelerisque tortor, nec eleifend dolor. Vestibulum justo arcu, volutpat vel fermentum et, tempus vulputate metus.</>
  <!-- Let's visibly hide this element and make screen readers ignore it. We need this element to check if the font is loaded. -->
      <div aria-visibility="hidden" class="hidden" style="font-family: 'Merriweather'">&nbsp;</div>
    /* If JavaScript is not available, 
     * you can use .no-js class to apply
     * web font styles.
     * If JS is available, 
     * this class will be removed.    


                body {
    font-size: 24px;
  line-height: 1.5;

.no-js {
  font-family: "Merriweather";

body:not(.wf-merriweather--loaded):not(.no-js) {
    font-family: Georgia, serif;
letter-spacing: 1.3px;
  font-size: 24px;

.hidden {
  position: absolute; 
  overflow: hidden; 
  clip: rect(0 0 0 0); 
  height: 1px; width: 1px; 
  margin: -1px; padding: 0; border: 0; 

/* Unrelated styles - formatting */

body {
  max-width: 568px;
  margin: 0 auto;
  padding: 1em;

p {
  margin-bottom: 1em;


                let interval = null;

function fontLoadListener() {
  var hasLoaded = false
       * If anything goes wrong with the font loading API, 
       * just change styles to the web font without handling FOUT 
      try {
        hasLoaded = document.fonts.check('12px "Merriweather"')
      } catch (error) {`document.fonts API error: ${error}`)
  if(hasLoaded) {

function fontLoadedSuccess() {
  if(interval) {
  document.getElementById("js-font-status").innerHTML = "finished loading";

 * We'll start the interval on button click so 
 * we don't run it all the time in the background 
 * when no loading is happening. 
 * You can uncomment the line on your project.
 * interval = setInterval(fontLoadListener, 500)

/* Button click code - not relevant to the example */

function loadFontCSS() {
  interval = setInterval(fontLoadListener, 500)
  var link = document.createElement("link");
  link.rel = "stylesheet";