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 includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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

              
                <table>
  <caption>
    <h1>Browser support for broken/missing images</h1>
    <p>Testcase on <a href="http://jsfiddle.net/yqSMQ/">jsFiddle</a>. Somewhat related article <a href="http://www.nczonline.net/blog/2009/11/30/empty-image-src-can-destroy-your-site/">by Nicholas C. Zakas</a>.</p>
    
    <blockquote cite="http://www.w3.org/wiki/HTML/Elements/img#A_phrase_or_paragraph_with_an_alternative_graphical_representation">
      <p>It is important to realize that the alternative text is a replacement for the image, not a description of the image.</p>
      <p class="source">&mdash; W3C</p>
    </blockquote>
    
    <blockquote cite="http://www.w3.org/wiki/Images_in_HTML#A_picture_says_more_than_a_thousand_words_.E2.80.94_or_does_it.3F">
      <p>People surfing on mobile devices might still have images turned off because of small screens and the cost of downloading data.</p>
      <p class="source">&mdash; W3C</p>
    </blockquote>
    
  </caption>
  <thead>
    <tr>
      <th scope="col">OS + Browser + Version</th>
      <th scope="col">
        <span class="tooltip" title="The element is showing the alt text">Alt text</span>
      </th>
      <th scope="col">
        <span class="tooltip" title="The element is showing some sort of a placeholder image to indicate that there should be an image">Placeholder</span>
      </th>
      <th scope="col">
        <span class="tooltip" title="The element has a border">Border</span>
      </th>
      <th scope="col">
        <span class="tooltip" title="The element has the dimensions specified by the width and height attributes">Dimensions</span>
      </th>
    </tr>
  </thead>
  <tbody id="tbody"></tbody>
</table>

<script type="t/template" id="t">
  {{#each platforms}}
    <tr class="os">
      <td>{{name}}</td>
      <td>Alt text</td>
      <td>Placeholder</td>
      <td>Border</td>
      <td>Dimensions</td>
    </tr>
    {{#each browsers}}
      <tr>
        <th scope="row">
          {{#if image}}
            {{#if note}}
              <a class="browser" href="{{image}}">{{name}}</a> 
              <span class="info" data-tooltip="{{note}}">&#119842;</span>
            {{else}}
              <a class="browser" href="{{image}}">{{name}}</a>
            {{/if}}
          {{else}}
            {{#if note}}
              <span class="browser">{{name}}</span>
              <span class="info" data-tooltip="{{note}}">&#119842;</span>
            {{else}}
              <span class="browser">{{name}}</span>
            {{/if}}
          {{/if}}
        </th>
        <td>
          {{#support.alt}}
            <span class="support-yes">&#x2713;</span>
          {{/support.alt}}
          {{^support.alt}}
            <span class="support-no">&#x2715;</span>
          {{/support.alt}}
        </td>
        <td>
          {{#support.placeholder}}
            <span class="support-yes">&#x2713;</span>
          {{/support.placeholder}}
          {{^support.placeholder}}
            <span class="support-no">&#x2715;</span>
          {{/support.placeholder}}
        </td>
        <td>
          {{#support.border}}
            <span class="support-yes">&#x2713;</span>
          {{/support.border}}
          {{^support.border}}
            <span class="support-no">&#x2715;</span>
          {{/support.border}}
        </td>
        <td>
          {{#support.dimensions}}
            <span class="support-yes">&#x2713;</span>
          {{/support.dimensions}}
          {{^support.dimensions}}
            <span class="support-no">&#x2715;</span>
          {{/support.dimensions}}
        </td>
      </tr>
    {{/each}}
  {{/each}}
</script>
              
            
!

CSS

              
                * {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}
html {
  font: 300 1em/1.5 Merriweather Sans, sans-serif;
  background-color: whitesmoke;
  color: #444;
}
table {
  border-collapse: collapse;
  margin-right: auto;
  margin-left: auto;
  width: 83.5%;
  max-width: 40em;
}
caption {
  text-align: left;
}
h1 {
  font-weight: 800;
  line-height: 1.1;
  margin: 1em 0 0.375em;
  letter-spacing: -0.0375em;
}
p,
blockquote,
table {
  margin-top: 0;
  margin-bottom: 1.5rem;
}
blockquote {
  padding-left: 1.5rem;
  font-style: italic;
  margin-left: 0;
  border-left: 0.25rem solid tomato;
}
blockquote > p:last-of-type {
  margin-top: -0.75rem;
  color: #999;
}
th, td {
  padding: 0.25em;
  text-align: center;
  border: 1px solid #ccc;
}
th:first-child,
td:first-child {
  text-align: left;
}
thead th {
  background-color: #444;
  color: whitesmoke;
}
td[colspan]:not(.browser) {
  background-color: #dedede;
}
.browser {
	font-weight: normal;
}
td, th {
  position: relative;
}
.info { text-decoration: none; }
.info:hover:before {
  content: attr(data-tooltip);
  position: absolute;
  background: #222;
  color: whitesmoke;
  bottom: 90%;
  left: -.5em;
  padding: 2px 3px;
  border-radius: 2px;
  z-index: 1;
}
.os {
  font-weight: 700;
  background-color: #ebebeb;
}
a {
  color: inherit;
}
.info {
  display: inline-block;
  vertical-align: baseline;
  background: #0d96a8;
  color: whitesmoke;
  font-size: 80%;
  padding: .125em .5em;
  line-height: 1;
  border-radius: 50%;
}
.support-yes,
.support-no,
.support-unknown {
  display: block;
}
.support-yes { color: green; background: rgba(0, 255, 0, 0.1); }
.support-no { color: red; background: rgba(255, 0, 0, 0.1); }
.support-unknown { color: #666; background: rgba(0, 0, 0, 0.1); }
              
            
!

JS

              
                var data = {
  "platforms": [
    {
      "name": "Lubuntu 13.04",
      "browsers": [
        {
          "name": "Chromium",
          "support": {
            "alt": true,
            "placeholder": true,
            "border": true,
            "dimensions": null
          }
        }, 
        {
          "name": "Firefox",
          "support": {
            "alt": true,
            "placeholder": false,
            "border": false,
            "dimensions": null
          }
        }
      ]
    }, 
    {
      "name": "Windows XP",
      "browsers": [
        {
          "name": "Internet Explorer 6",
          "image": "https://dl.dropboxusercontent.com/u/25917336/WindowsXPIE6.png",
          "note": "image renders too tall",
          "support": {
            "alt": true,
            "placeholder": true,
            "border": true,
            "dimensions": true
          }
        }
      ]
    },
    {
      "name": "Windows Vista",
      "browsers": [
        {
          "name": "Internet Explorer 7",
          "image": "https://dl.dropboxusercontent.com/u/25917336/WindowsVistaIE7.png",
          "note": "Image renders too tall",
          "support": {
            "alt": true,
            "placeholder": true,
            "border": true,
            "dimensions": false
          }
        }
      ]
    },
    {
      "name": "Windows 7",
      "browsers": [
        {
          "name": "Internet Explorer 9",
          "image": "https://www.dropbox.com/s/yggscj38yzsqwek/Windows7IE9.png",
          "note": "Emulated IE 9 via devTools",
          "support": {
            "alt": true,
            "placeholder": true,
            "border": true,
            "dimensions": true
          }
        },
        {
          "name": "Internet Explorer 10",
          "image": "https://www.dropbox.com/s/wz4f6h22ivz0jjs/Windows7IE10.png",
          "support": {
            "alt": true,
            "placeholder": true,
            "border": true,
            "dimensions": true
          }
        },
        {
          "name": "Chrome",
          "image": "https://www.dropbox.com/s/g42vqwtouanpz4m/Windows7Chrome29.png",
          "support": {
            "alt": true,
            "placeholder": true,
            "border": true,
            "dimensions": true
          }
        },
        {
          "name": "Firefox",
          "image": "https://www.dropbox.com/s/cpnyckzlg1t04p4/Windows7Firefox24.png",
          "support": {
            "alt": true,
            "placeholder": false,
            "border": false,
            "dimensions": false
          }
        },
        {
          "name": "Opera",
          "image": "https://www.dropbox.com/s/tvntltk3ywu5k3m/Windows7Opera16.png",
          "support": {
            "alt": true,
            "placeholder": true,
            "border": true,
            "dimensions": true
          }
        }
      ]
    },
    {
      "name": "Windows 8",
      "browsers": [
        {
          "name": "Internet Explorer 10",
          "note": "Yet to be tested",
          "support": {
            "alt": null,
            "placeholder": null,
            "border": null,
            "dimensions": null
          }
        },
        {
          "name": "Internet Explorer 11",
          "note": "Yet to be tested",
          "support": {
            "alt": null,
            "placeholder": null,
            "border": null,
            "dimensions": null
          }
        }
      ]
    },
    {
      "name": "Mac OSX",
      "browsers": [
        {
          "name": "Safari",
          "image": "https://www.dropbox.com/s/06rf3e9w2akz10o/MacOSSafari.png",
          "support": {
            "alt": true,
            "placeholder": true,
            "border": true,
            "dimensions": true
          }
        },
        {
          "name": "Firefox",
          "image": "https://dl.dropboxusercontent.com/u/25917336/MacOSFirefox24.png",
          "note": "Image collapses",
          "support": {
            "alt": true,
            "placeholder": false,
            "border": false,
            "dimensions": false
          }
        },
        {
          "name": "Chrome",
          "image": "https://dl.dropboxusercontent.com/u/25917336/MacOSChrome30.png",
          "support": {
            "alt": true,
            "placeholder": true,
            "border": true,
            "dimensions": true
          }
        },
        {
          "name": "Opera",
          "image": "https://dl.dropboxusercontent.com/u/25917336/MacOSOpera17.png",
          "support": {
            "alt": true,
            "placeholder": true,
            "border": true,
            "dimensions": true
          }
        }
      ]
    },
    {
      "name": "Android 2.2.1 (HTC Wildfire)",
      "browsers": [
        {
          "name": "Stock browser",
          "image": "https://dl.dropboxusercontent.com/u/25917336/Android2.2.1Default.png",
          "support": {
            "alt": true,
            "placeholder": true,
            "border": true,
            "dimensions": true
          }
        }
      ]
    },
    {
      "name": "Android 2.3.?",
      "browsers": [
        {
          "name": "Stock browser",
          "support": {
            "alt": null,
            "placeholder": null,
            "border": null,
            "dimensions": null
          }
        }
      ]
    },
    {
      "name": "Android 4.0.4 (HTC Desire S)",
      "browsers": [
        {
          "name": "Stock browser",
          "image": "https://dl.dropboxusercontent.com/u/25917336/Android4.0.4Default.png",
          "support": {
            "alt": true,
            "placeholder": true,
            "border": true,
            "dimensions": false
          }
        }
      ]
    },
    {
      "name": "Android 4.1.2 (Samsung Galaxy Core)",
      "browsers": [
        {
          "name": "Stock browser",
          "image": "https://dl.dropboxusercontent.com/u/25917336/Android4.1.2Default.png",
          "support": {
            "alt": true,
            "placeholder": true,
            "border": true,
            "dimensions": true
          }
        },
        {
          "name": "Chrome for Android",
          "image": "https://dl.dropboxusercontent.com/u/25917336/Android4.1.2Chrome.png",
          "support": {
            "alt": true,
            "placeholder": true,
            "border": true,
            "dimensions": true
          }
        }
      ]
    },
    {
      "name": "Android 4.4.2 (Samsung Galaxy S4)",
      "browsers": [
        {
          "name": "Stock browser",
          "image": "https://dl.dropboxusercontent.com/u/25917336/Android4.4.2Default.png",
          "support": {
            "alt": true,
            "placeholder": false,
            "border": true,
            "dimensions": true
          }
        },
        {
          "name": "Chrome for Android",
          "image": "https://dl.dropboxusercontent.com/u/25917336/Android4.4.2Chrome.png",
          "support": {
            "alt": true,
            "placeholder": true,
            "border": true,
            "dimensions": true
          }
        }
      ]
    },
    {
      "name": "iOS 6 (iPod 4th gen.)",
      "browsers": [
        {
          "name": "Safari",
          "image": "https://dl.dropboxusercontent.com/u/25917336/iOS6Safari.png",
          "support": {
            "alt": true,
            "placeholder": false,
            "border": true,
            "dimensions": true
          }
        }
      ]
    },
    {
      "name": "iOS 7",
      "browsers": [
        {
          "name": "Safari",
          "image": "https://dl.dropboxusercontent.com/u/25917336/iOS7Safari.png",
          "support": {
            "alt": true,
            "placeholder": true,
            "border": true,
            "dimensions": true
          }
        }
      ]
    },
    {
      "name": "iOS 8.1",
      "browsers": [
        {
          "name": "Safari",
          "image": "https://dl.dropboxusercontent.com/u/25917336/iOS8Safari.png",
          "support": {
            "alt": true,
            "placeholder": false,
            "border": true,
            "dimensions": true
          }
        }
      ]
    },
    {
      "name": "Windows Phone 8.1",
      "browsers": [
        {
          "name": "Internet Explorer",
          "image": "https://dl.dropboxusercontent.com/u/25917336/WindowsPhone8.1IE.jpg",
          "support": {
            "alt": true,
            "placeholder": true,
            "border": false,
            "dimensions": false
          }
        }
      ]
    }
  ]
};

var source = document.getElementById("t").innerHTML;
var template = Handlebars.compile(source);
document.getElementById("tbody").innerHTML = template(data);
              
            
!
999px

Console