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

Quick-add: + add another resource

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.

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.

            
              <div class="typer">
  <h1>Insert your favorite letter</h1>
  <h2>Sorry, no numbers yet!</h2>
  <input type="text" maxlength = "1"/>
  <div class="font-container alphabet">
    <div class="letter"></div>
  </div>
</div>

<div class="example alphabet">
  <h1>The letters, in all their glory</h1>
  <div class="letter cycle-letter a"></div>
  <hr>
  <div class="letter a"></div>
  <div class="letter b"></div>
  <div class="letter c"></div>
  <div class="letter d"></div>
  <div class="letter e"></div>
  <div class="letter f"></div>
  <div class="letter g"></div>
  <div class="letter h"></div>
  <div class="letter i"></div>
  <div class="letter j"></div>
  <div class="letter k"></div>
  <div class="letter l"></div>
  <div class="letter m"></div>
  <div class="letter n"></div>
  <div class="letter o"></div>
  <div class="letter p"></div>
  <div class="letter q"></div>
  <div class="letter r"></div>
  <div class="letter s"></div>
  <div class="letter t"></div>
  <div class="letter u"></div>
  <div class="letter v"></div>
  <div class="letter w"></div>
  <div class="letter x"></div>
  <div class="letter y"></div>
  <div class="letter z"></div>
</div>

<div class="eljamez alphabet">
  <div class="letter e"></div>
  <div class="letter l"></div>
  <div class="letter j off"></div>
  <div class="letter a off"></div>
  <div class="letter m off"></div>
  <div class="letter e off"></div>
  <div class="letter z off"></div>
</div>
            
          
!
            
              @import "bourbon";

// colors
$light-gray: #ddd;
$dark-gray: #333;
$border-gray: #ccc;
$border-radius: 10%;

// positions
$sixth: 16.665%;
$third: 33.33%;
$half: 50%;
$two-thirds: 67%;

// box width/height
$box-width: 60px;
$box-height: 60px;

body {
  color: $dark-gray;
  font-family: 'Open Sans', sans-serif;
}

.eljamez, .typer, .example, .looper {
  background: $light-gray;
  border: 1px solid $border-gray;
  border-radius: 3px;
  margin-bottom: 10px;
  overflow: hidden;
  padding: 60px;
  position: relative;
  text-align: center;
}

.checker {
  overflow: hidden;
  h1 {
    color: white;
    text-align: center;
  }
}

.typer {
  input {
    border-radius: 10px;
    border: 0px;
    box-sizing: border-box;
    font-size: 1.5em;
    height: $box-height;
    padding: 20px;
    text-align: center;
    width: $box-width;
  }
}

.alphabet{
  background: $light-gray;
  > div {//Letter
    @include transition(all .5s ease-in-out);
    background: $dark-gray;
    border-radius: $border-radius;
    box-sizing: border-box;
    cursor: pointer;
    display: inline-block;
    height: $box-height;
    margin: 10px;
    position: relative;
    text-align: center;
    width: $box-width;
    &::before, &::after {
      @include transition(all .5s ease-in-out);
      border: 1px solid transparent;
      box-sizing: border-box;
      display: block;
      left: 0%;
      content: '';
      position: absolute;
      top: 0%;
    }
    &.off {
      &::before, &::after {
        @include transform(scale(.5));
        opacity: 0;
      }
    }
  }
  
  // Letters
  .a {
    &::before, &::after {
      border-right: 1px solid $light-gray;
      min-height: $third;
      min-width: $half;
    }
    &::before {
      top: $sixth;
    }
    &::after {
      top: $two-thirds;
    }
  }
  .b {
    &::before {
      border-bottom: 1px solid $light-gray;
      border-top: 1px solid $light-gray;
      left: $third;
      min-height: $third;
      min-width: $third;
      top: $third;
    }
    &::after {
      background: $light-gray;
      border-radius: 50%;
      left: 90%;
      min-height: 20%;
      min-width: 20%;
      top: 40%;
    }
  }
  .c {
    &::before {
      border-bottom: 1px solid $light-gray;
      left: $third;
      min-height: $half;
      min-width: $two-thirds;
    }
  }
  .d {
    &::before {
      background: $dark-gray;
      min-height: 100%;
      min-width: $sixth;
    }
    &::after {
      border-bottom: 1px solid $light-gray;
      left: $third;
      min-height: $half;
      min-width: $third;     
    }
  }
  .e {
    &::before {
      border-bottom: 1px solid $light-gray;
      border-top: 1px solid $light-gray;
      left: $third;
      min-height: $third;
      min-width: $two-thirds;
      top: $third;
    }
  }
  .f {
    &::before, &::after {
      left: $third;
      min-height: $third;
      min-width: $two-thirds;
    }
    &::before {
      border-top: 1px solid $light-gray;
      top: $third;
    }
    &::after {
      border-radius: $border-radius;
      background: $light-gray;
      top: $two-thirds;
    }
  }
  .g {
    &::before {
      background: $light-gray;
      left: $two-thirds;
      min-height: $sixth;
      min-width: $two-thirds;
      top: $third;
    }
    &::after {
      background: $light-gray;
      border-radius: $border-radius;
      left: $third;
      min-height: $third;
      min-width: $half;
      top: $third;
    }
  }
  .h {
    &::before, &::after {
      border-right: 1px solid $light-gray;
      min-height: $third;
      min-width: $half;
    }
    &::before {
      top: 0%;
    }
    &::after {
      top: $two-thirds;
    }
  }
  .i {
    &::before, &::after {
      border-bottom: 1px solid $light-gray;
      min-height: $third;
      min-width: $third;
      top: $sixth;
    }
    &::before {
      left: 0px;
    }
    &::after {
      left: $two-thirds;
    }
  }
  .j {
     &::before {
      background: $light-gray;
      border-radius: 3px;
      min-width: $two-thirds;
      min-height: $two-thirds;
    }
  }
  .k {
    &::before, &::after {
      min-height: $third;
    }
    &::before {
      border-bottom-right-radius: 100%;
      background: $light-gray;
      left: $third;
      min-width: $third;
    }
    &::after {
      border-top-right-radius: 100%;
      background: $light-gray;
      left: $third;
      min-width: $third;
      top: $two-thirds;
    }
  }
  .l {
    &::before {
      background: $light-gray;
      border-radius: $border-radius;
      min-height: $two-thirds;
      left: $third;
      min-width: $two-thirds;
    }
  }

  .m {
    &::before {
      border-right: 1px solid $light-gray;
      min-height: $two-thirds;
      min-width: $third;
      top: $third;
    }
    &::after {
      border-right: 1px solid $light-gray;
      left: $third;
      min-height: $two-thirds;
      min-width: $third;
      top: $third;
    }
  }
  .n {
    &::before {
      border-right: 1px solid $light-gray;
      min-height: $two-thirds;
      min-width: $third;
      top: $third;
    }
    &::after {
      border-right: 1px solid $light-gray;
      left: $third;
      min-height: $two-thirds;
      min-width: $third;
    }
  }
  .o {
    &::after {
      border-bottom: 1px solid $light-gray;
      left: $third;
      min-height: $half;
      min-width: $third;
    }
  }
  .p {
    &::before, &::after {
      min-height: $third;
    }
    &::before {
      border-top: 1px solid $light-gray;
      left: $third;
      min-width: $third;
      top: $third;
    }
    &::after {
      border-radius: $border-radius;
      background: $light-gray;
      left: $third;
      min-width: $two-thirds;
      top: $two-thirds;
    }
  }
  .q {
    &::before {
      background: $dark-gray;
      border-radius: $border-radius;
      left: $two-thirds;
      min-height: $sixth;
      min-width: $sixth;
      top: 100%;
    }
    &::after {
      border-bottom: 1px solid $light-gray;
      border-radius: $border-radius;
      height: $half;
      left: $third;
      width: $third;     
    }
  }
  .r {
    &::before, &::after {
      height: $third;
    }
    &::before {
      border-top: 1px solid $light-gray;
      left: $third;
      min-width: $third;
      top: $third;
    }
    &::after {
      border-top-right-radius: 100%;
      background: $light-gray;
      left: $third;
      min-width: $third;
      top: $two-thirds;
    }
  }
  .s {
    &::before, &::after {
      min-height: $third;
      min-width: $two-thirds;
    }
    &::before {
      border-bottom: 1px solid $light-gray;
      left: $third;
    }
    &::after {
      border-bottom: 1px solid $light-gray;
      top: $third;
   }
  }
  .t {
    &::before, &::after {
      background: $light-gray;
      border-radius: $border-radius;
      min-height: $two-thirds;
      min-width: $third;
      top: $third;
    }
    &::after {
      left: $two-thirds;
    }
  }
  .u {
    &::before {
      //background: $light-gray;
      //border-radius: $border-radius;
      border-left: 1px solid $light-gray;
      left: $half;
      min-height: $two-thirds;
      min-width: $third;
    }
    &::after {
      opacity: 0;
    }
  }
  .v {
    overflow: hidden;
    &::before {
      @include transform(rotate(45deg));
      background: $light-gray;
      left: 35%;
      min-height: $third;
      min-width: $third;
      top: -$sixth;
    }
    &::after {
      opacity: 0;
    }
  }
  .w {
    &::before {
      border-left: 1px solid $light-gray;
      border-right: 1px solid $light-gray;
      left: $third;
      min-height: $two-thirds;
      min-width: $third;
    }
  }
  .x {
    background: $light-gray;
    &::before, &::after {
      background: $dark-gray;
      border-radius: $border-radius;
      min-height: 100%;
      min-width: $half;
    }
    &::before {
      @include transform(rotate(45deg));
      left: $half / 2;
    }
    &::after {
      @include transform(rotate(-45deg));
      left: $half / 2;
    }
  }
  .y {
    overflow: hidden;
    &::before {
      //border-bottom-left-radius: 100%;
      //background: $light-gray;
      border-left: 1px solid $light-gray;
      left: $half;
      min-height: $third;
      min-width: $third;
    }
    &::after {
      background: $light-gray;
      border-top-right-radius: 100%;
      border-bottom-right-radius: 100%;
      min-height: $third;
      min-width: $two-thirds;
      top: $half;
    }
  }
  .z {
    &::before, &::after {
      min-height: $third;
      min-width: $two-thirds;
    }
    &::before {
      border-bottom: 1px solid $light-gray;
    }
    &::after {
      border-bottom: 1px solid $light-gray;
      left: $third;
      top: $third;
    }
  }
}
            
          
!
            
              // create the class for this pen
class FontViewer {
  constructor() {
    this.alphabet = "abcdefghijklmnopqrstuvwxyz".split('');
    this.hoverLetter($('.eljamez'));
    this.autoToggleOnOff($('.eljamez'));
    this.inputLetter($('.typer input'), $('.font-container > .letter'));
    this.loopThroughLetters($('.example > .cycle-letter'));
  }
  loopThroughLetters($letterToAffect) {
    const flipTiming = 1500;
    let i = 0;
    let init = setInterval( () => {
      $letterToAffect.removeClass(this.alphabet[i]);
      if (i >= this.alphabet.length-1) {
        i = -1;
      }
      i++;
      this.animateLetter($letterToAffect, 'flip');//pass in effected element and animate.css animation type
      $letterToAffect.addClass(this.alphabet[i]);
    }, flipTiming);
  }
  animateLetter($element, animationType) {
    // animate.css animate type
    animationType = animationType || "pulse";
    let animationClasses = 'animated ' + animationType; 
    let animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend'; 
    $element.addClass(animationClasses).one(animationEnd,function() {
      $element.removeClass(animationClasses);        
    });
  }
  autoToggleOnOff($container) {
    const intervalTiming = 2000;
    let init = setInterval( () => {
      let $toggledLetter = $container.find('.letter');
      this.animateLetter($toggledLetter, 'rubberBand');
      $toggledLetter.toggleClass('off');      
    }, intervalTiming);
  }
  initLetterClick(thisLetter) {
    thisLetter.on('click', () => {
       thisLetter.toggleClass('off');
    });    
  }
  hoverLetter($hoverContainer) {
    for( var i = 0; i < $hoverContainer.find('.letter').length; i++) {
      var thisLetter = $hoverContainer.find('.letter:nth-of-type('+i+')');
      this.initLetterClick(thisLetter);
    }
  }
  inputLetter($input, $outputLetter) {
    $input.on('keyup', () => {
      $outputLetter.removeClass();
      $outputLetter.addClass($($input).val());
      this.animateLetter($outputLetter, 'wobble');
    }); 
  }
}

var fontViewer = new FontViewer();
            
          
!
999px
Loading ..................

Console