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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

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.

		<link href=',300,700,500' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="//" />
    <h1>Android L ripple effect <br /><span class="secondary-text">( without Polymer and jQuery )</span></h1>
    <p>Just add 'material' attribute to any DOM element. <br />
      Supports both mouse and touch events. See more at <a href="" target="_blank"></a>
    <h2>Flat buttons</h2>
    <div class="buttons-wrapper">
    	<button material>Button</button>
    	<button material class="colored-btn">Colored</button>
       <button material disabled>Test</button>
    <h2>Raised buttons</h2>
    <div class="buttons-wrapper">
    	<button material raised>Button</button>
    	<button material raised colored class="colored-btn">Colored</button>
       <button material raised disabled>Test</button>
    <h2>Floated buttons</h2>
    <div class="buttons-wrapper">
    	<button material primary class="floated">
    		<i class="fa fa-lock"></i>
      <button material secondary class="floated">
    		<i class="fa fa-lock"></i>

* Demo settings
body { margin: 0; background: #fff; font-family: 'Roboto'; font-weight: 300; }
h1 { font-weight: 300; text-align: center; }
h2 { font-size: 1.16em; text-align: center; font-family: 'Roboto' font-weight: 500; margin-top: 25px; margin-bottom: 5px; }
h1 .secondary-text { font-size: .6em; }
p { text-align: center; }
button { display: block; padding: 8px 6px; margin: 1em; width: 10em; font-size: 1em; text-transform: uppercase; }
.buttons-wrapper { display: flex; justify-content: center; }
.colored-btn { color: rgb(66, 133, 244); }
button.floated {  }

/* End demo */

[material] { position: relative; overflow: hidden;  text-align: center; border: none; background: none; }
[material][disabled] { background: rgb(234, 234, 234); }
[material][primary] { background: #cecece; width: 56px; height: 56px; -webkit-clip-path: circle(32px at 32px 32px); clip-path: circle(32px at 32px 32px); line-height: 32px; border-radius: 50%; font-size: 24px; }
[material][raised] { border-radius: 3px; }
[material][raised]:not([disabled]) { box-shadow: 0 3px 3px rgba(0, 0, 0, 0.16), 0 3px 3px rgba(0, 0, 0, 0.23); 
transition: .3s all ease-in-out; background: #dfdfdf;
{ box-shadow: 0 14px 14px rgba(0, 0, 0, 0.25), 0 10px 5px rgba(0, 0, 0, 0.22); }

[material][raised][colored] { color: #fff; background: #4285f4; }

[material][secondary] { background: #cecece; width: 40px; height: 40px; -webkit-clip-path: circle(40px at 20px 20px); clip-path: circle(40px at 20px 20px); line-height: 16px; border-radius: 50%; font-size: 18px; }
[material]:focus { outline: none; }

.ripple { display: block; position: absolute; background: rgba(0,0,0,.1); border-radius: 100%; -webkit-transform: scale(0); transform: scale(0); }
/*animation effect*/
.ripple.animate { -webkit-animation: ripple 0.65s linear; animation: ripple 0.65s linear; }

@-webkit-keyframes ripple {
	100% {opacity: 0; -webkit-transform: scale(2.5); transform: scale(2.5);}
@keyframes ripple { 100% {opacity: 0; -webkit-transform: scale(2.5); transform: scale(2.5);}

 * Helper function, that allows to attach multiple events to selected objects
 * @param {[object]}   el       [selected element or elements]
 * @param {[type]}   events   [DOM object events like click or touch]
 * @param {Function} callback [Callback method]
var addMulitListener = function(el, events, callback) {
  // Split all events to array
  var e = events.split(' ');
    // Loop trough all elements, function(element, i) {
      // Loop trought all events and add event listeners to each, function(event, i) {
        element.addEventListener(event, callback, false);
}  ;

 * This function is adding ripple effect to elements
 * @param  {[object]} e [DOM objects, that should apply ripple effect]
 * @return {[null]}   [description]
addMulitListener(document.querySelectorAll('[material]'), 'click touchstart', function(e) { 
    var ripple = this.querySelector('.ripple');
    var eventType = e.type;
     * Ripple
    if(ripple == null) {
      // Create ripple
      ripple = document.createElement('span'); 
      // Prepend ripple to element
      this.insertBefore(ripple, this.firstChild);

      // Set ripple size
      if(!ripple.offsetHeight && !ripple.offsetWidth) {
        var size = Math.max(,; = size + 'px'; = size + 'px';


    // Remove animation effect

    // get click coordinates by event type
    if(eventType == 'click') {
      var x = e.pageX;
      var y = e.pageY;
    } else if(eventType == 'touchstart') {
      var x = e.changedTouches[0].pageX;
      var y = e.changedTouches[0].pageY;
    x = x - this.offsetLeft - ripple.offsetWidth / 2;
    y = y - this.offsetTop - ripple.offsetHeight / 2;

    // set new ripple position by click or touch position = y + 'px'; = x + 'px';

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.