Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


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


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.


Auto Save

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.


                <div class="component">
  <p class="typewriter js-typewriter">
    Typewriters had been invented as early as 1714 by Henry Mill and reinvented in various forms throughout the 1800s. It was to be Sholes, however, who invented the first one to be commercially successful.
  <button class="btn-replay" onclick="app.replay(event)">replay


                $duration-typing: 300ms;
$duration-background: 1000ms;
$delay-unit: 100ms;
$color: #111;
html {
  font-size: 20px;
  @media(min-width: 600px) {
    font-size: 30px;

body {
  margin: 0;
  font-family: Courier, Helvetica, sans-serif;
  background: #fafafa;

.component {
  padding: .5rem;
  text-align: center;
  margin: 0 auto;
  max-width: 1000px;
  .typewriter {
    margin: .5rem;
    padding: 1rem .5rem;
    text-align: left;
    font-weight: 300;
    > span {
      display: inline-block;
    &.animate {
      > span > i {
        animation: typewriter $duration-typing forwards, background $duration-background forwards;
       //  animation: typewriter $duration-typing steps(1) forwards;
    > span > i {
      opacity: 0;
      // display: inline-block;
      color: $color;
      font-style: normal;
      font-size: 1em;
      min-width: .4em;
      border-radius: 2px;
      @for $i from 1 through 30 {
        &:nth-of-type(#{$i}) {
          animation-delay: $i*$delay-unit;
  .btn-replay {
    padding: .5rem;
    background: white;
    border: 0;
    box-shadow: 1px 1px 2px #777;
    text-transform: uppercase;
    cursor: pointer;

@keyframes typewriter {
  50% {
    transform: scale(1.4);
  100% {
    opacity: 1;

@keyframes background {
  0% {
    //text-shadow: 0 0 2rem $color; // expensive anim
   background: rgba($color,.1);
    //box-shadow: 0 0 4rem rgba($color,.9); // expensive anim
  100% {}


       = (_ => {

  let log = console.log.bind(console),
    messageElement = document.querySelector('.js-typewriter'),
    text = messageElement.innerText.trim();

  let words = text.split(' ');
  let work = [];

  words.forEach(word => {
    let splitWord = word.split('').map((char, index) => {
      return `<i>${char}</i>`;
  let formattedWords =, index) => {
    return `<span>${word}</span>`;
  }).join(' ');

  messageElement.innerHTML = formattedWords;

  return {
    replay: (event) => {
      messageElement.offsetHeight; // force reflow
      setTimeout(_ => {