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

Packages

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.

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.

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.

HTML

              
                <div>
  <div class="mat-example small">
  -S-BUTTON
</div>
  <div class="mat-example medium">
  -M-BUTTON
</div>

<div class="mat-example big">
  Material Design Button
</div>

</div>
<!-- Just a concept, not the most reusable code ever. Should be easily scalable though. If you make a plug in from this concept please link me (; If you know how to stop the text from blurring when translated, comment the solution -->
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Roboto:400,500);

.mat-example{ /*general styling for all buttons*/
  font-family: "Roboto";
  color: #244549;
  position: absolute;
  background: #31ce74;
  cursor: pointer;
  overflow: hidden;
  text-align: center;
  box-shadow: 0px 2px 10px 3px rgba(0,0,0,0.15);
  text-shadow: none;
  transition: all .3s ease-out;
}

.mat-example.hovered { /*makes it 'elevate'*/
  transform: scale(1.05) !important;
}

.ripple{ /*stylings for the circular overlay*/
  position: absolute;
  border-radius: 100%;
  width: 0;
  height: 0;
  background: rgba(0,0,0, .05);
  transition: all .3s ease-out;
}

.notransition{ /*used to reset the ripple without an animatiion*/
  transition: none !important;
}

/*just the button stylings*/

.mat-example.big{
 position: absolute;
 top: 0;
 left: 50%;
 margin-left: -200px;
 margin-top: 50px;
 width: 400px;
 height: 200px;
 font-size: 24px;
 line-height: 200px;
}

.mat-example.small{
  position: absolute;
  padding: 10px;
  margin-top: 50px;
  margin-left: 40px;
}

.mat-example.medium{
  padding: 10px;
  font-size: 24px;
  margin-top: 50px;
  margin-left: 200px;
  
}
              
            
!

JS

              
                $(document).ready( function (){
  //appends the overlay to each button
    $(".mat-example").each( function(){
    $(this).append("<div class='ripple'></div>");
    });
  
  
    $(".mat-example").click(function(e){
      var $clicked = $(this);
      
      //gets the clicked coordinates
      var offset = $clicked.offset();
  var relativeX = (e.pageX - offset.left);
  var relativeY = (e.pageY - offset.top);
      var width = $clicked.width();
      
      
      var $ripple = $clicked.find('.ripple');
      
      //puts the ripple in the clicked coordinates without animation
      $ripple.addClass("notransition");
      $ripple.css({"top" : relativeY, "left": relativeX});
      $ripple[0].offsetHeight;
      $ripple.removeClass("notransition");
      
      //animates the button and the ripple
      $clicked.addClass("hovered");
      $ripple.css({ "width": width * 2, "height": width*2, "margin-left": -width, "margin-top": -width });
      
      setTimeout(function(){
          //resets the overlay and button
          $ripple.addClass("notransition");
          $ripple.attr("style", "");
          $ripple[0].offsetHeight;
          $clicked.removeClass("hovered");
        $ripple.removeClass("notransition");
      }, 300 );
    });
});
                  
              
            
!
999px

Console