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


Add 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 or require. We'll also process your JavaScript with Babel.

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


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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <p class="fontClass"><code>fontSwitcher</code> dynamically loads any font from the <a href="" target="_blank">Google Fonts</a> repository and applies it to existing text.</p>
<p class='fontClass goItalic'>(Current version v3.0 is <a href=''>available on GitHub</a> and also supports <a href=''>Adobe Edge Web Fonts</a>.)</p>
<button id="fontButton" onclick="var newFont=prompt('New Google Font?');fontSwitcher(newFont, 'fontClass');">Try it</button>
<p class="fontClass">To use <code>fontSwitcher</code>, include this line between your <code>&#060;head&#062;</code> and <code>&#060;/head&#062;</code> tags:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>&#060;script src=""&#062;&#060;/script&#062;</code></p>
<p class="fontClass">Call <code>fontSwitcher</code> in this format:</p>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>fontSwitcher('newFontName', 'elementClass'[, 'fallbackFont1', 'fallbackFont2' ...]);</code>
<p class="fontClass">where <code>newFontName</code> is the new font to load and <code>elementClass</code> is the class to attach the new font to.</p>
<p><code>fallbackFont1</code> (and additional fallback fonts, if any) is the font to fall back to if the primary font does not load for any reason. The fallback font can be a native or pre-loaded font, a generic font, or it can even be a Google web font (if the web font has already been loaded).  If using a Google web font as a fallback font and you loaded it with <code>fontSwitcher</code>, make sure it has been applied to an alternative class, so that the <code>&#060;link&#062;</code> element is not overwritten.</p>
<p class="fontClass">Capitalization and spacing matter for Google font names.</p>
<p class="fontClass">You can use <code>fontSwitcher</code> to apply multiple Google fonts on the same page; just call the function once for each class.</p>
<p class="fontClass">To attach multiple classes to an element, use the format:</p>
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>class="<span class="goItalic">class1 class2</span>"</code>
<p class="fontClass">You can use Google's <a href="" target="_blank">Web Font Loader</a> instead, but <code class="goBold">fontSwitcher</code> automatically applies the new font to any class you specify, so you can use it for multiple fonts at the same time.</p>
<p class="fontClass"><code>fontSwitcher</code> can also be used to apply local fonts (ie. Courier, Arial) but it may be slower than simply changing the <code>fontFamily</code> attribute since it will still call to Google first.</p>
<p class="fontClass">Licensed under the <a href="" target="_blank">MIT License</a>.</p>
<p class="fontClass">More improvements will be coming, including support for font styles and effects.</p>
              body {
  background-color: #efefef;
  width: 97%;
  padding: 3px;
  font-size: 1.2em;
a:hover {
  text-decoration: none;
.fontClass {
  font-family: serif;
#fontButton {
  font-family: monospace;
  font-size: 1.2em;
  display: inline;
  position: relative;
  font-weight: bold;
  color: darkblue;
  margin-top: 10px;
  margin-left: 5px;
  background: #d1d1d1;
ul {
  color: black;
  font-family: serif;
  margin-left: -7px;
.goItalic {
  font-style: italic;
              function fontSwitcher(newFontName, elementClass) {  

  function checkLink() {
    //check to see if link element for this class has already been built
      if (!(document.getElementById(linkName))) {
        //if fontSwitcher link for this class doesn't exist, create it
        var linkElement=document.createElement("link");;
    else if (!((document.getElementById(linkName).rel=="stylesheet") &&
          (document.getElementById(linkName).type=="text/css"))) {

  function makeURL(fontName) {
    //create URL to grab the Google font
    for (var i=0;i<(fontName.length);i++) {
      if (fontName.charAt(i)==" ") {
      else {
    return newFontURL;

  function checkFallbacks() {
    //check if any fallback fonts specified
    if (fontArgs.length<=2) {
    //loop through fontArgs and add each fallback font to the string
    for (incr=2; incr<fontArgs.length;incr++) {
        if (!!checkGeneric(fontArgs[incr])) {
            //if fallback font is generic
        else {
  function checkGeneric(thisFont) {
    //check to see if it's a generic font; if it is, return true
    switch (thisFont.toLowerCase()) {
        case 'serif':
        case 'sans-serif':
        case 'cursive':
        case 'fantasy':
        case 'monospace':
    return generic;
  // ------- execution starts here ------------
  var newFontURL=makeURL(newFontName);
  var linkName="FS"+elementClass;
  var fontArgs=arguments;
  var fallbackString='';
  var classToChange;
  if (!checkGeneric(newFontName)) {
    //if non generic font
  else {
  for (var i=0;i<classToChange.length;i++){