cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

              <h1>Improving Web Font Performance with Local Storage (Demo)</h1>

<p>I am speaking on literary criticism, and in the world in which we are actually living that is almost as unpromising as speaking about peace. This is not a peaceful age, and it is not a critical age. In the Europe of the last ten years literary criticism of the older kind — criticism that is really judicious, scrupulous, fair-minded, treating a work of art as a thing of value in itself — has been next door to impossible.</p>

<p class="p">Demo by Luis Vieira. <a href="http://www.sitepoint.com/improving-font-performance-subsetting-local-storage/" target="_blank">See article</a> (publishing April 7, 2015).</p>
              body {
  text-align: center;
  line-height: 1.5;
  padding: 0 30px;

.fallback {
  font-family: 'Georgia', serif;
  line-height: 1.7em;
  letter-spacing: 1px;
  font-size: 15px;

.webFont {
  font-family: 'vollkornregular', serif;
  line-height: 1.6em;
  letter-spacing: 1px;
  font-size: 16px;

p {
  text-align: left;

.p {
  padding-top: 100px;
  text-align: center;
  font-size: 14px;
              (function () {
  'use strict';
  document.documentElement.className = 'fallback';
  var css_href = 'https://codepen.io/SitePoint/pen/6c6dc49b39b410083cd30ac1f16be2fa.css';
  var localStorageSupported = function() {
    try {
      localStorage.setItem('test', 'test');
      return true;
    } catch(e) {
      return false;

  if (localStorageSupported() && localStorage.spdemowebFonts) {
  } else {
    window.onload = function() {

  function injectFontsStylesheet() {
    var xhr = new XMLHttpRequest();
      xhr.open('GET', css_href, true);
      xhr.onreadystatechange = function() {
        if (xhr.readyState === 4) {
          localStorage.setItem('spdemowebFonts', xhr.responseText);

  function injectRawStyle(text) {
    var style = document.createElement('style');
    style.innerHTML = text;
    document.documentElement.className = 'webFont';
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................