Pen Settings

HTML

CSS

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

JavaScript

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

Behavior

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.

HTML

              
                <header class="site-header">
  <div class="max-width">
    <h1 class="heading__primary">Font Families</h1>
    
    <nav class="toggle-nav">
      <a href="#" data-toggle="all" class="active">All</a>
      <a href="#" data-toggle="display">Display</a>
      <a href="#" data-toggle="sans">Sans Serif</a>
      <a href="#" data-toggle="serif">Serif</a>
      <a href="#" data-toggle="monospace">Monospace</a>
    </nav>
  </div>
</header>

<article class="content-section" id="display">
  <header class="content-section__header">
    <div class="max-width">
      <h1 class="heading__tertiary">Display</h1>
    </div>
  </header>

  <div id="displayList" class="max-width">
    <!-- Display Fonts -->
  </div>
</article>

<article class="content-section" id="sans">
  <header class="content-section__header">
    <div class="max-width">
      <h1 class="heading__tertiary">Sans Serif</h1>
    </div>
  </header>

  <div id="sansList" class="max-width">
    <!-- Sans Serif Fonts -->
  </div>
</article>

<article class="content-section" id="serif">
  <header class="content-section__header">
    <div class="max-width">
      <h1 class="heading__tertiary">Serif</h1>
    </div>
  </header>

  <div id="serifList" class="max-width">
    <!-- Serif -->
  </div>
</article>

<article class="content-section" id="monospace">
  <header class="content-section__header">
    <div class="max-width">
      <h1 class="heading__tertiary">Monospace</h1>
    </div>
  </header>

  <div id="monospaceList" class="max-width">
    <!-- Monospace Fonts -->
  </div>
</article>

<footer class="site-footer">
  <div class="max-width">
    <p>This site is for educational purposes in connection with the <a href="https://www.gswo.org/">Girl Scouts of Western Ohio</a>. All image rights are retained solely by the original sources. Learn more at <a href="http://girlscancode.io">Girls Can Code</a>.</p>
  </div>
</footer>
              
            
!

CSS

              
                
              
            
!

JS

              
                function displayItem(font, type) {
  var codeValue = font.replace(/ /g, '+');
  
  $('#'+type+'List')
    .append('<div class="card"><h3 class="card__heading" style="font-family: \''+font+'\'">'+font+'</h3><p class="card__sample" style="font-family:\''+font+'\'">Danish liquorice dragée cupcake liquorice. Tootsie roll dessert dragée jujubes wafer carrot cake. Cheesecake liquorice tart sugar plum.</p><h4>Add this to the top of your CSS pane:</h4><code class="code code--font-family">@import url(https://fonts.googleapis.com/css?family='+codeValue+');</code><h4>Add this to your CSS rule:</h4><code class="code code--font-family">font-family: \'' + font + '\';</code></div>');
}

// Font Lists
var fonts = {
  display: ['Bungee','Indie Flower', 'Passion One', 'Lobster', 'Shadows Into Light', 'Pacifico', 'Amatic SC', 'Dancing Script', 'Sigmar One', 'Bangers', 'Chewy', 'Cherry Swash'],
  sans: ['Open Sans', 'Roboto', 'Lato', 'Source Sans Pro', 'Raleway', 'Ubuntu', 'Droid Sans', 'Arimo', 'PT Sans Narrow', 'Noto Sans'],
  serif: ['Slabo', 'Lora', 'Roboto Slab', 'Droid Serif', 'PT Serif', 'Bitter', 'Playfair Display', 'Arvo', 'Noto Serif', 'Libre Baskerville'],
  monospace: ['Source Code Pro', 'Inconsolata', 'VT323', 'Anonymous Pro', 'Cutive Mono']
};

// Import Google Fonts
var importFonts = '';
$.each(fonts, function(index, type) {
  $.each(type, function(index, family) {
    family = family.replace(/ /g, '+');
    importFonts += family + '|';
  });
});
$('head').append(
  '<link href="https://fonts.googleapis.com/css?family=' + importFonts + '" rel="stylesheet" type="text/css">'
);


// Display
$.each(fonts['display'], function(index, value) {
  displayItem(value, 'display');
});

// Sans
$.each(fonts['sans'], function(index, value) {
  displayItem(value, 'sans');
});

// Serif
$.each(fonts['serif'], function(index, value) {
  displayItem(value, 'serif');
});

// Monospace
$.each(fonts['monospace'], function(index, value) {
  displayItem(value, 'monospace');
});
              
            
!
999px

Console