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

              
                div
  button.raised Button
  button.raised.edge Edge
  button.flat Flat
  button.float
    i.fa.fa-star
  button.float.edge
    i.fa.fa-star
br
.card
  h1 Title
  p Text <br> More Text
  .hr
  button.flat.right Info
  
              
            
!

CSS

              
                body {
  font-family: 'Roboto';
  background: hsl(0, 0, 95);
  color: rgba(black, .85);
}

@function shadow($z) {
  @return 0px $z ($z * 2) rgba(black, 0.25), 0px 0px $z rgba(black, 0.125);
}

@keyframes ink-visual-show {
  from {
    opacity: 1;
    transform: scale(0);
  }
  
  15% {
    opacity: 1;
  }
  
  to {
    transform: scale(1);
  }
}

@keyframes ink-visual-hide {
  from { }

  to {
    opacity: 0;
  }
}

$accent: hsl(120, 100, 75);
$ease: cubic-bezier(0.25, 0.5, 0.75, 1);
$ease-out: cubic-bezier(0.25, 0.5, 0.5, 1);
$ease-in: cubic-bezier(0.5, 0, 0.75, 0.5);

button {
  transition-duration: 0.2s;
  transition-timing-function: $ease-out;
  position: relative;
  padding: 0;
  height: auto;
  border: none;
  border-radius: 2px;
  outline: none;
  font-size: 14px;
  font-weight: 500;
  font-family: 'Roboto';
  line-height: 1em;
  text-transform: uppercase;
  color: rgba(black, .73);

  &:active {
    transition-duration: 0s;
  }

  .btn {
    position: relative;
    padding: 8px 16px;
    z-index: 2;
  }

  .ink-visual-container {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 2px;
    z-index: 1;
    
    .ink-visual-static {
      position: static;
      width: 100%;
      height: 100%;
      overflow: hidden;
      border-radius: 2px;
    }
    
    .ink-visual {
      animation: ink-visual-show 0.45s $ease-out;
      animation-fill-mode: both;
      transition-property: opacity;
      transition-duration: 0.35s;
      transition-timing-function: $ease-out;
      position: absolute;
      border-radius: 50%;
      pointer-events: none;
      opacity: 1;
      z-index: -1;
      
      &.hide {
        opacity: 0;
      }
    }
  }

  &.raised, &.float {
    $def-bkgd: hsl(105, 75, 40);
    $hover-bkgd: mix($def-bkgd, white, 85);
    $active-bkgd: hsl(105, 75, 37);
    
    transition-property: box-shadow, background;
    background-color: $def-bkgd;
    box-shadow: shadow(2px);
    color: white;

    &:hover {
      box-shadow: shadow(4px);
      background-color: $hover-bkgd;
    }

    &:active {
      box-shadow: shadow(1px);
      background-color: $active-bkgd;

      html.ink-btn & {
        background-color: $hover-bkgd;
      }
    }
    
    .ink-visual {
      background-color: $active-bkgd;
    }
    
    &.edge .ink-visual-static {
      box-shadow: 0 1px 1px 0 rgba(white, .5) inset, 0 -1px 1px 0 rgba(black, .25) inset;
    }
  }

  &.flat {
    $active-bkgd: hsl(0, 0, 75);
    
    transition-property: background-color;
    background: none;
    color: hsl(120, 75, 35);
    
    &:active {
      background-color: $active-bkgd;
      
      html.ink-btn & {
        background: none;
      }
    }
    
    .ink-visual {
      background-color: $active-bkgd;
    }
  }
  
  &.float {
    $def-bkgd: hsl(30, 95, 50);
    $hover-bkgd: hsl(30, 95, 57);
    $active-bkgd: hsl(30, 95, 47);
    
    border-radius: 50%;
    width: 56px;
    height: 56px;
    font-size: 16px;
    box-shadow: shadow(2px);
    background-color: $def-bkgd;
    
    &:hover {
      box-shadow: shadow(4px);
      background-color: $hover-bkgd;
    }
    
    &:active {
      box-shadow: shadow(1px);
      background-color: $active-bkgd;
      
      html.ink-btn & {
        background-color: $hover-bkgd;
      }
    }
    
    .ink-visual-container {
      border-radius: 50%;
    }
    
    .ink-visual-static {
      border-radius: 50%;
    }
    
    .ink-visual {
      background: $active-bkgd;
    }
  }
}

.card {
  display: flex;
  flex-flow: column nowrap;
  margin: 4px;
  padding: 4px;
  background: white;
  border-radius: 2px;
  box-shadow: shadow(2px);
  
  h1, h2, h3, h4, h5, h6, p {
    margin: 0;
    padding: 0;
  }
  
  .hr {
    margin: 4px -4px 3px;
    border-bottom: 1px solid rgba(black, .15);
  }
}

.right {
  align-self: flex-end;
}
              
            
!

JS

              
                (function($, undefined) {
  $("html").addClass("ink-btn");

  var sqrt2 = Math.sqrt(2);

  function hypot(x, y) { return Math.sqrt((x * x) + (y * y)); }

  $("button").each(function(el) {
    var self = $(this),
        html = self.html();

    self.html("").append($('<div class="btn"/>').html(html));
  })
  .append($('<div class="ink-visual-container"/>').append($('<div class="ink-visual-static"/>')))
  
  .on("select", function(evt) { event.preventDefault(); return false; })
  .on("mousedown touchstart", function(evt) {
    event.preventDefault();
    
    var self = $(this),
        container = self.find(".ink-visual-static", true).eq(0);

    if(!container.length) return;

    container.find(".ink-visual").addClass("hide");
    
    var rect = this.getBoundingClientRect(),
        cRect = container[0].getBoundingClientRect(),
        cx, cy, radius, diam;

        if (event.changedTouches) {
          cx = event.changedTouches[0].clientX;
          cy = event.changedTouches[0].clientY;
        }
        else {
          cx = event.clientX;
          cy = event.clientY;
        }

    if(self.is(".float")) {
      var rx = rect.width / 2,
          ry = rect.height / 2,
          br = (rx + ry) / 2,
          mx = rect.left + rx,
          my = rect.top + ry;

      radius = hypot(cx - mx, cy - my) + br;
    }
    else {
      var w = Math.max(cx - rect.left, rect.right - cx),
          h = Math.max(cy - rect.top, rect.bottom - cy);
      
      radius = hypot(w, h);
    }
    diam = radius * 2;
        
    var el = $('<div class="ink-visual"/>').width(diam).height(diam)
    .css("left", cx - cRect.left - radius).css("top", cy - cRect.top - radius)
    
    .on("animationend webkitAnimationEnd oanimationend MSAnimationEnd", function() {
      var self2 = $(this);

      switch(event.animationName) {
        case "ink-visual-show":
          self2.addClass("shown");
          if (!self.is(":active")) self2.addClass("hide");
          break;

        case "ink-visual-hide":
          self2.remove();
          break;
      }
    })
    
    .on("touchend", function() { event.preventDefault(); });

    container.append(el);
  });

  $(window).on("mouseup touchend", function(evt) {
    $(".ink-visual-static").children(".ink-visual").addClass("hide");
  })
  .on("select selectstart", function(evt) { event.preventDefault(); return false; });
}(jQuery))
              
            
!
999px

Console