css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

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.

              <div class="header">
  <div class="container">
    <div class="search-container">
      <label for="font"><i class="fa fa-search"></i></label>
      <input id="font-search" class="font-search" type="text" value="" data-provide="typeahead" title="Search for a Google Font">
      <i class="fa fa-refresh random" title="Get a random font"></i>
<div class="container" id="content">
  <div class="main">
    <h1>Lorem Ipsum</h1>
    <p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante.</p>
    <p>Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href="#">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Suscipit quam error vitae eaque vero molestiae eius perferendis aspernatur unde earum eos sit. Perspiciatis eius similique obcaecati quasi quidem odit voluptatem.</p>
    <h2>Header Level 2</h2>
    <p>Repellat a possimus suscipit pariatur temporibus facilis sint modi fugit voluptate est aspernatur porro hic odit facere dolor veritatis odio nisi. Ipsum?</p>
      <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
      <li>Aliquam tincidunt mauris eu risus.</li>
      <li>Perspiciatis eius similique obcaecati quasi quidem odit voluptatem.</li>
    <h3>Header Level 3</h3>
      <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
      <li>Aliquam tincidunt mauris eu risus.</li>
      <li>Mauris placerat eleifend leo.</li>

  <aside class="sidebar">
    <div id="variants"></div>
    <ul id="visited" class="history"></ul>
<div class="container">
  <div class="colophon">
    <p>There are currently <span id="count"></span> font families.</p>
    <p>Made by <a href="http://katydecorah.com">Katy DeCorah</a> with the <a href="https://www.google.com/fonts">Google Fonts API</a>.</p>
              @import "compass/css3";

// You can check out the repo for the Sass, I'm too lazy to update it here:
// https://github.com/katydecorah/google-font-explorer
              var url ="https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyDK4Jz71F7DQCrUhXYaF3xgEXoQGLDk5iE";

var family = "";
var families = [];
var visited = [];


  // counts all the families
  var countFamilies = json.items.length;

  // pushes all the font families to an array

// Bootstrap Typeahead
  source: families,
  updater:function (item) {

// Gets the font based on family name
function runFont(family) {
      if (type.family === family) {
        var familyPlus = family.replace(/\s/g, '+');
        var familyCSS = "https://fonts.googleapis.com/css?family=" + familyPlus + ":" + type.variants + "";
        var details = $("#variants");

        // Removes previous family and style

        // Grabs family details
        details.append("<div class='detail-title'>Variants</div><ul class='list-variant'></ul>");
        $(type.variants).each(function(index, item) {
        details.append("<div class='detail-title'>Subsets</div><ul class='list-subsets'></ul>");
        $(type.subsets).each(function(index, item) {
        details.append("<div class='detail-title horizontal'>Version</div><div class='detail-data'>" + type.version + "</div>");
        details.append("<div class='detail-title horizontal'>Last Modified</div><div class='detail-data'>" + type.lastModified + "</div>");
        details.append("<div class='detail-title'>HTML</div><div class='detail-data'><pre><code class='language-markup'>&lt;link href='"+familyCSS+"' rel='stylesheet' type='text/css'&gt;</code></pre></div>");
        details.append("<div class='detail-title'>CSS</div><div class='detail-data'><pre><code class='language-css'>font-family: '"+family+"', sans-serif;</code></pre></div>");
        details.append("<a href='https://www.google.com/fonts#UsePlace:use/Collection:"+familyPlus+"' class='btn'>View on Google Fonts &rarr;</a>");

        // Grabs the Google Font
        $("head").append("<link href='"+ familyCSS +"' rel='stylesheet' type='text/css' class='style'>");

        // If family has italic or bold, allow it
          $("head").append("<style>.main em { font-style: italic; }");
          $("head").append("<style>.main strong,h1,h2,h3 { font-weight: 700; }");
        else if(details.text().match('800')){
          $("head").append("<style>.main strong,h1,h2,h3 { font-weight: 800; }");
        else if(details.text().match('900')){
          $("head").append("<style>.main strong,h1,h2,h3 { font-weight: 900; }");

        // Save visited families
        visited.push( family );
        var visit="";
        $.each(visited, function(i, val) {
          visit+= "<li class='link-history' data-family='"+ val +"'>" + val + "</li>";

        // Creates link to view that font again
          var dat = $(this).attr("data-family");

          // remove first instance from array
          if ($.inArray(dat, visited) !== -1) {
            visited.splice( $.inArray(dat, visited), 1 );


// Gets a random font
function random() {
    var count = json.items.length,
    random = Math.ceil(Math.random() * count);
      if(i === random){
        var family = type.family;
        $("#font-search").attr("placeholder", family);

// Picks a random font on click

// Runs to fetch random font

🕑 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 ..................