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.

+ add another resource


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


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.


                - var btnText1 = 'Submit'
- var btnText2 = 'Share this page'
- var btnText3 = 'Looking good, Billy Ray!'
- var btnText4 = 'Feeling good, Louis!'
- var btnText5 = 'Now go backwards'

h1 Lettering.js Button Hover States
  button.btn.btn--action.btn--one()= btnText1
  button.btn.btn--action.btn--two(data-duration="0.4" data-stagger="0.018")= btnText2
  button.btn.btn--action.btn--three(data-duration="0.2" data-stagger="0.014")= btnText3
  button.btn.btn--action.btn--four(data-duration="0.8" data-stagger="0.04")= btnText4
  button.btn.btn--action.btn--five(data-duration="0.3" data-stagger="-0.014")= btnText5


                @import url(',700');

$black: black;
$blue: lightblue;
$gray: lightslategray;
$green: darkseagreen;
$red: crimson;
$tan: tan;
$white: white;

$base--font-family: 'Lato', Arial, sans-serif;
$base--trans-speed: 0.4s;
$base--trans-timefunc: cubic-bezier(0.645, 0.045, 0.355, 1);

@function em($pixels, $context: 16) {
  @return #{$pixels/$context}em;

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: em(12);
  min-height: 100vh;

main {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;

h1 {
  margin-bottom: em(24);
  font-family: $base--font-family;
  font-size: em(30);
  line-height: 1.2;
  font-weight: 700;

// Buttons
.btn {
  $btn--padding: em(12) em(24);
  $btn--margin: em(6);
  $btn--offset: 4px;
  $btn--trans: $base--trans-speed $base--trans-timefunc;
  display: inline-block;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  margin: $btn--margin;
  padding: $btn--padding;
  font-size: em(18);
  font-family: $base--font-family;
  text-transform: uppercase;
  letter-spacing: em(0.05);
  border: none;
  border-radius: em(2);
    background-color $btn--trans,
    border-color $btn--trans,
    box-shadow $btn--trans,
    transform $btn--trans;
  &:before {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    transform: translateY(100%);
    transition: transform $btn--trans;
  &:focus {
    transform: translateY(-$btn--offset);
    box-shadow: rgba(black, 0.4) 0 em(6) em(24) em(-6);
    &:before {
      transform: translateY(0);
  &:active {
    transform: translateY(-$btn--offset + 1px);
    transition: transform 0s;
  &--action [class^="word"] {
    display: inline-block;
  &--action [class^="char"] {
    display: inline-block;
    position: relative;
    overflow: hidden;
    z-index: 2;
    &.letter-space {
      width: em(4);
    span {
      display: inline-block;
    span:before {
      content: attr(data-letter);
      display: block;
      position: absolute;
      top: 110%;
      z-index: 3;

// Button configurations
// (bg color, hover bg color, text color, hover text color)
$btn-config: (
  one: ($blue, darken($blue, 10%), $black, $white),
  two: ($green, darken($green, 10%), $black, $white),
  three: ($red, lighten($red, 10%), $white, $black),
  four: ($gray, lighten($gray, 10%), $white, $black),
  five: ($tan, darken($tan, 10%), $black, $white)

@each $name, $option in $btn-config {
  $btn--bg-color: nth($option, 1);
  $btn--bg-color--hover: nth($option, 2);
  $btn--txt-color: nth($option, 3);
  $btn--txt-color--hover: nth($option, 4);
  .btn--#{$name} {
    color: $btn--txt-color;
    background-color: $btn--bg-color;
    &:before {
      background-color: $btn--bg-color--hover;
      background: linear-gradient(to top, $btn--bg-color--hover, transparent);

    &:focus {
      outline-color: $btn--bg-color;
    span:before {
      color: $btn--txt-color--hover;


                var $body = $('body');
var $btnAction = $('.btn--action');
var innerWrapClass = 'inner-wrap';
var $letter, $letterWrapper, $innerWrapper;

// Wrap words

// Wrap letters
$letter = $btnAction.find('[class^="char"]');

// Wrap inner to hide overflow on each letter
$letter.each(function() {
  $letterWrapper = $(this).find('span');
    .attr('data-letter', $(this).text());
  // Add class to text spaces
  if ($'letter') === ' ') {

// Setup animation
$btnAction.each(function(index, el) {
  var tl, duration, stagger, anim;
  $innerWrapper = $(el).find('.' + innerWrapClass);
  tl = new TimelineMax({paused: true});
  duration = $(el).attr('data-duration') ? $(el).data('duration') : 0.3;
  stagger = $(el).attr('data-stagger') ? $(el).data('stagger') : 0.03;
  anim = tl.staggerTo($innerWrapper, duration, {
    y: '-110%',
    ease: Back.easeOut
  }, stagger);
  el.animation = anim;
  // Apply animation to hover and focus states
  $(el).on("mouseenter focusin", function() {;
  }).on("mouseleave focusout", function() {