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.

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.

HTML

            
              <h1>The Odyssey, Book I</h1>
<h1 class="overlap">The Odyssey, Book I</h1>
<h1 class="overlap split-text colors">The Odyssey, Book I</h1>
<div class="content-container">
  <h2>A story by Homer</h2>
  <p>Tell me, <em>O muse</em>, of that ingenious hero who travelled far and wide after he had sacked the famous town of Troy. Many cities did he visit, and many were the nations with whose manners and customs he was acquainted; moreover he suffered much by sea while trying to save his own life and bring his men safely home; but do what he might he could not save his men, for they perished through their own sheer folly in eating the cattle of the Sun-god Hyperion; so the god prevented them from ever reaching home. Tell me, too, about all these things, O daughter of Jove, from whatsoever source you may know them. 
  </p>
</div>


            
          
!

CSS

            
              @font-face {
  font-family: 'Roboto Extremo';
  src: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/57225/RobotoExtremo-VF-slnt-alpha.woff2') format('woff2 supports variations'), url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/57225/RobotoExtremo-VF-slnt-alpha.woff2') format('woff2-variations');
  font-stretch: 25% 150%;
  font-weight: 100 900;
}

html {
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: inherit;
}
  
body {
  background-color: #f1f1fa;
  color: #224;
  font-family: 'Roboto Extremo', sans-serif;
  font-size: 1.25rem;
  font-stretch: 100%;
  font-weight: 400;

}

h1 {
  font-family: "Roboto Extremo", sans-serif;
  font-size: calc( 12vw + 1em );
  font-stretch: 150%;
  font-weight: 900;
  line-height: 1.1;
  margin: 0;
  padding: 0;
  text-transform: uppercase;  
}

h1 + h1 {
  margin-top: 5rem;
}

.overlap {
  /* set up transparency and overlap */
  color: rgba(0,0,45,.5);
  letter-spacing: -0.25em;
  line-height: 0.7;
  word-break: break-all;
  word-spacing: 0.35em;
  
}

/* mix up the letter colors a bit */
.colors span:nth-child(odd) {
  color: rgba(0,0,75,.4);
}

.colors span:nth-child(5n+1) {
  color: rgba(35,50,00,.5);
}

.colors span:nth-child(7n+0) {
  color: rgba(0,80,95,.55);
}

h2 {
  font-family: "Roboto Extremo", sans-serif;
  font-size: 2rem;
  font-synthesis: none;
  font-variation-settings: 'slnt' -8;
}

strong {
  font-synthesis: none;
  font-weight: 650;
}
em {
  font-synthesis: none;
  font-variation-settings: 'slnt' -8;
}

.content-container {
  margin: 2rem auto;
  max-width: 98vw;
}
  @media (min-width: 45em) {
    .content-container {
      max-width: 40rem; 
    }
  }
  @media (min-width: 55em) {
    .content-container {
      max-width: 42rem; 
    }
  }
  @media (min-width: 65em) {
    .content-container {
      max-width: 46rem; 
    }
  }


            
          
!

JS

            
              // Text from the split-text element
const splitElement = document.querySelector('.split-text');
const str = splitElement.innerHTML;

const words = str.split(' ');
const chars = str.split('');


  // Remove the existing text so it can be replaced by the characters in spans
splitElement.innerHTML = '';
// Set up an aria-label so screen readers will still read out the whole string
splitElement.setAttribute('aria-label', str);

chars.forEach(function (item, index) {
  var c = document.createElement('span');
  // and give it some content 
  var letter = document.createTextNode(item); 
  // add the text node to the newly created span
  c.appendChild(letter);  
  // add the newly created element and its content into the DOM 
  splitElement.append(c);

  // Add aria-hidden to each character if the aria-label has been applied to the parent
  if (c.parentElement.getAttribute('aria-label')) {
    c.setAttribute('aria-hidden', true);
  }

});

            
          
!
999px

Console