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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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>WebKit &lt;=536.11 font load bug</h1>
<p>WebKit versions prior to 536.11 have a bug where the normal CSS font stack is ignored while loading web fonts. Instead of falling back on the next font it will fall back to the generic font family (or the default generic font family) of the first instance the web font is mentioned in CSS. It switches to this font immediately while loading the web font, causing two changes in font (whereas other browsers only change font when the web font has loaded.)</p>

<h2 id="header" style="font-family: monospace; display: inline-block;white-space:nowrap;font-variant:small-caps;">This should display in monospace and then Sniglet</h2>

<p>The following log shows the three states of web font loading: before loading, during loading and after loading.</p>
<pre id="log"></pre>
<p>Browsers without the fallback bug will have identical widths for the first two states and a different width for the third state (given a clean cache). Browsers with the bug will show three unique widths for each state.</p>
<p>The bug has been fixed and only happens in WebKit versions below 536.11. See also WebKit bug <a href="https://bugs.webkit.org/show_bug.cgi?id=76684">#76684</a>.</p>
              var h2 = document.getElementById('header'),
    log = document.getElementById('log');

log.textContent += 'Width of header before load: ' + h2.offsetWidth + 'px.\n';

h2.style.fontFamily = 'sniglet, monospace';

log.textContent += 'Width of header during load: ' + h2.offsetWidth + 'px.\n';

// Use a setTimeout of 3 seconds. We assume the font has loaded after 3 seconds. It would
// be more accurate to detect font loading, but this would unnecessarily complicate the
// example.
window.setTimeout(function () {
  log.textContent += 'Width of header after load:  ' + h2.offsetWidth + 'px.\n';
}, 3000);
Loading ..................