Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


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


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.


Auto Save

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.


                <div id="button" v-ripple>Button</div>



                #button {
  align-items: center;
  background-color: #4DACFF;
  border: none;
  border-radius: 10px;
  color: white;
  display: flex;
  font-size: 32px;
  height: 120px;
  justify-content: center;
  overflow: hidden;
  position: relative;
  width: 240px;

.ripple {
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0);
  position: absolute;
  opacity: 1;

.ripple-effect {
  animation: ripple-drop .6s linear;

@keyframes ripple-drop {
  100% {
    transform: scale(2);
    opacity: 0;



                new Vue({
  el: "#button",
  directives: {
    ripple: {
      bind: updateRipple,
      unbind: removeRipple

// aligned with CSS animation duration
// 与CSS动画时长一致

function updateRipple(el) {
  "ontouchstart" in document.documentElement
    ? el.addEventListener("touchstart", rippleShow, { passive: true })
    : el.addEventListener("mousedown", rippleShow);

function rippleShow(e) {
  // get click/press position
  // 确定点击/触摸位置
  const posX = e.pageX - e.currentTarget.offsetLeft;
  const posY = e.pageY - e.currentTarget.offsetTop;

  // calculate ripple width and height
  // 计算ripple层宽高
  let buttonWidth = e.currentTarget.offsetWidth;
  let buttonHeight = e.currentTarget.offsetHeight;
  buttonWidth > buttonHeight
    ? (buttonHeight = buttonWidth)
    : (buttonWidth = buttonHeight);

  // calculate ripple absolute coordinates
  // 绝对定位添加ripple层
  let spanEl = document.createElement("span");
  spanEl.className = "ripple"; = buttonWidth + "px"; = buttonHeight + "px"; = posY - buttonHeight / 2 + "px"; = posX - buttonWidth / 2 + "px";


  // remove DOM to increase performance
  // 移除DOM提升性能
  setTimeout(() => {

function removeRipple(el) {
  el.removeEventListener("touchstart", rippleShow);
  el.removeEventListener("mousedown", rippleShow);