cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              .container
  p
    a.btn(href="") 
      span.fallback-text Cloud Button
      
.container
  p
    a.btn.alt(href="") 
      span.fallback-text Cloud Button
            
          
!
            
              // transitions
@mixin transition($property, $duration)
  -webkit-transition: $property $duration ease-in-out
  -moz-transition: $property $duration ease-in-out
  -o-transition: $property $duration ease-in-out
  transition: $property $duration ease-in-out

$color-1: #ec6252 // dark red
$color-2: #f0f0f2 // light grey
$color-3: #f08578 // light red

body
  background: $color-2
  font-family: 'helvetica Neue'
  font-weight: 300
  font-size: 14px
  
p
  text-align: center
 
.container
  width: 460px
  max-width: 100%
  margin: 50px auto
 
a.btn
  width: 190px
  height: 130px
  letter-spacing: 1px
  text-transform: uppercase
  display: inline-block
  position: relative
  padding-bottom: 100px
  z-index: 2
  overflow: hidden
  margin: 0
  padding: 0

  svg
    width: 190px
    height: 130px
    position: absolute
    top: 0
    left: 0
    text-anchor: middle

    &.svg-button
      stroke: $color-1
      stroke-width: 3px
      stroke-miterlimit: 1.0
      stroke-linejoin: miter
      -webkit-filter: drop-shadow(0 3px 2px rgba(0,0,0,.1))
      filter: drop-shadow(0 3px 2px rgba(0,0,0,.1))
      fill: url(#redGradient)
      @include transition(all, .5s)

      text
        font-weight: 400
        fill: white
        stroke: none
  
      &:hover
        -webkit-filter: drop-shadow(0 3px 5px rgba(0,0,0,.3))
        filter: drop-shadow(0 3px 5px rgba(0,0,0,.3))
        transform: translate(0, -4px)
        text
          fill: white
          stroke: none

  &.alt svg.svg-button
    fill: $color-1
    stroke: black
    stroke-dasharray: 1060
    stroke-dashoffset: 1060

    text
      fill: $color-2
      stroke: none

    &:hover
      stroke-dasharray: 1060
      stroke-dashoffset: 0

      text
        fill: black
        stroke: none
            
          
!
            
              # Cool buttons with SVG
# no library dependencies

supportsSVG = ->
  !!document.createElementNS and !!document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect

if supportsSVG
  
  btn_shape_path = 'M162.658,74.635c0,16.55-13.52,31.07-28.93,31.07h-104.8c-15.41,0-28.93-14.52-28.93-31.07s13.52-31.07,28.93-31.07 c0.27,0,0.53,0.04,0.79,0.08c0.25,0.03,0.51,0.07,0.77,0.09l2.02,0.17l0.59-1.97c3.68-12.26,14.64-20.5,27.27-20.5 c1.48,0,3.04,0.14,4.76,0.44l1.75,0.3l0.86-1.57c7-12.71,20.24-20.6,34.55-20.6c21.81,0,39.56,18.01,39.56,40.16 c0,0.9-0.04,1.78-0.1,2.66l-0.12,1.93l1.78,0.65C154.568,49.445,162.658,61.745,162.658,74.635z'
  btns = document.getElementsByClassName("btn")

  addSVG = (btns, i) ->
    texts = btns.getElementsByClassName('fallback-text')[0]
    svgDoc = document.createElementNS('http://www.w3.org/2000/svg', "svg")
    svgDoc.setAttributeNS(null, "preserveAspectRatio", 'xMidYMin meet')
    svgDoc.setAttributeNS(null, "viewBox", '0 0 180 120')
    svgDoc.setAttributeNS(null, "class", 'svg-button')
    svgBtn = document.createElementNS('http://www.w3.org/2000/svg', "path")
    svgBtn.setAttributeNS(null, "d", btn_shape_path)
    svgBtn.setAttribute('transform','translate(8, 5)')
    defs = document.createElementNS('http://www.w3.org/2000/svg', "defs")
    gradient = document.createElementNS('http://www.w3.org/2000/svg', "linearGradient")
    gradient.setAttributeNS(null, "id", 'redGradient')
    gradient.setAttributeNS(null, "x2", '0%')
    gradient.setAttributeNS(null, "y2", '100%')
    stop1 = document.createElementNS('http://www.w3.org/2000/svg', "stop")
    stop1.setAttributeNS(null, "offset", '0%')
    stop1.setAttributeNS(null, "stop-color", '#f08578')
    stop2 = document.createElementNS('http://www.w3.org/2000/svg', "stop")
    stop2.setAttributeNS(null, "offset", '100%')
    stop2.setAttributeNS(null, "stop-color", '#ec6252')
    text = document.createElementNS('http://www.w3.org/2000/svg', "text")
    text.setAttributeNS(null, "x", '50%')
    text.setAttributeNS(null, "y", '70%')
    text.setAttributeNS(null, "text-anchor",  'middle')
    btns.appendChild(svgDoc)
    svgDoc.appendChild(svgBtn)
    texts.setAttribute "style", "display:none;"
    btn_text = texts.childNodes[0].nodeValue
    textNode = document.createTextNode(btn_text)
    
    btns.appendChild(svgDoc)
    svgDoc.appendChild(defs)
    defs.appendChild(gradient)
    gradient.appendChild(stop1)
    gradient.appendChild(stop2)
    svgDoc.appendChild(svgBtn)
    svgDoc.appendChild(text)
    text.appendChild(textNode)
    
  [].forEach.call(btns, addSVG)
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console