Pen Settings

HTML

CSS

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

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

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.

HTML

              
                svg(width='0', height='0', display='none', version='1.1', aria-hidden='true', focusable='false', xmlns='http://www.w3.org/2000/svg', xmlns:xlink='http://www.w3.org/1999/xlink')
  symbol#circle(viewbox='0 0 2 2')
    circle(cx='1', cy='1', r='1')

mixin btn(txt, duration)
  button.btn(class!=attributes.class, data-duration='#{duration}')
    | #{txt}
    svg.ripple
      use.ripple__circle(width='100%', height='100%', xlink:href='#circle')

+btn('Uebaa!', 1)(class='btn--blue')
+btn('Uterere!', 3)(class='btn--green')
+btn('Ulala!', 5)(class='btn--red')

              
            
!

CSS

              
                $black = black

$cores = {
  green: #26AB7B
  blue: #26ABFF
  red: #FF2649  
}

$btn
  position relative
  box-sizing border-box
  padding 1em
  margin 10px
  overflow hidden
  border-radius 10px
  will-change background-color
  transition 0.5s background-color

btn($cor)
  background-color: $cor
  &:hover
  &:focus
    background-color: darken($cor, 20%)
    outline: none

body
  display flex
  align-items center
  justify-content center
  background-color #FFCC00
  height 100vh
  margin 0
  padding 0
  font-size 100%

button 
  appearance none
  border none
  border-radius 10px
  font-family 'Roboto', sans-serif
  font-weight 400
  font-size 1.3em
  color white
  box-shadow rgba(0, 0, 0, 0.1) 0px 1px 1.5px 0px, rgba(0, 0, 0, 0.25) 0px 1px 1px 0px

.btn
  @extend $btn
  
for $k, $v in $cores
  .btn--{$k}
    btn($v)

.ripple
  pointer-events none
  position absolute
  top 0
  left 0
  z-index: 0
  width: 100%
  height: 100%
  fill: rgba($black, 0.3)
    
.ripple__circle
  opacity 0
              
            
!

JS

              
                function rippleAnimation(event) {
	const target = event.target
	const circle = target.querySelector('.ripple__circle')
	const duration = target.dataset.duration || 1;
	const w = target.offsetWidth;
	const h = target.offsetHeight;
	const x = (-w / 2) + event.offsetX;
	const y = (-h / 2) + event.offsetY;
	TweenLite.fromTo(circle, duration, {
		x,
		y,
		scale: 0,
		opacity: 1,
		transformOrigin: '50% 50%'
	}, {
		scale: 10,
		opacity: 0
	});
}

const btns = document.querySelectorAll('.btn');

// Old way
[].forEach.call(btns, btn => {
	btn.addEventListener('click', rippleAnimation);
});

// Future feature - Works on Firefox
/*
for (btn of btns) {
  btn.addEventListener('click', rippleAnimation);
}
// */
              
            
!
999px

Console