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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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 class="text">
  <span>Row one text</span>
  <span>You can always have a lot of content</span>

<h1 class="text">
  <span>Sometimes I do</span>

<h1 class="text">
  <span>And by accident</span>
  <span>it's something</span>

<h1 class="text">
  <span>You're not alone</span>
  <span>in this lonely</span>

<h1 class="text">
  <span>Mozilla Firefox</span>
  <span>Google Chrome</span>
  <span>Windows Internet Explorer</span>
  <span>Opera Browser</span>
  <span>Apple Safari</span>
              body {
  text-align: center;

h1.text {
  display: inline-block;
  font-size: 1em;
  margin: 1em;
  padding: .25em;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;

h1.text span {
  display: block;
  font-size: 1em;

h1.text:hover {
  background: red;
  color: white;

h1.text:nth-of-type(1) {
  font-family: serif;

h1.text:nth-of-type(2) {
  font-family: sans-serif;

h1.text:nth-of-type(3) {
  font-family: 'Segoe UI', 'Helvetica';

h1.text:nth-of-type(4) {
  font-family: 'Lucida Console', monospace;

h1.text:nth-of-type(5) {
  left: 50%;
  top: 50%;
  opacity: .3;
  position: absolute;
  transform: rotate(-45deg) scale(2);
  transform-origin: 100% 100%;
  z-index: -1;
              // http://stackoverflow.com/questions/118241/calculate-text-width-with-javascript
// this version here is adjusted to be more dynamic
(function($) {
  $.textMetrics = function(el) {
    var tm = document.createElement('span'),
      $tm = $(tm);
      border: 0,
      padding: 0,
      position: 'absolute',
      visibility: 'hidden'
      document.createTextNode(el.textContent || el.innerText)
    var rect = tm.getClientRects()[0];
    return {
      height: rect.bottom - rect.top,
      width: rect.right - rect.left

// custom implementation
    var widths = [], maxwidth = 0, width = 0;
      width = $.textMetrics(this)['width'];
      widths.push({el: this, width: width});
      if(maxwidth < width) maxwidth = width;
        'font-size': (w.width > 0 ? maxwidth / w.width : 0).toFixed(5) + 'em'
Loading ..................