cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

            
              <div id="stage">
  
  <!-- The button HTML code -->
  <a href="#" class="the-click-button">I'm the perfect button!</a>

  <audio id="clickSound"><source src="http://vincent.polenordstudio.fr/snap/clickup.mp3">
  </source><source src="http://vincent.polenordstudio.fr/snap/clickip.ogg"></source></audio>
	
  <audio id="clickUpSound"><source src="http://vincent.polenordstudio.fr/snap/click.mp3"></source><source src="http://vincent.polenordstudio.fr/snap/click.mp3"></source></audio>

  <audio id="wooshSound"><source src="http://vincent.polenordstudio.fr/snap/sub_bass_whoosh.mp3"></source></audio>
<audio id="wooshSoundOut"><source src="http://vincent.polenordstudio.fr/snap/sub_bass_mouseover.wav"></source></audio>



  <!-- End of the button HTML code -->



  
</div>

<!-- The following code is for pen informations only -->

<div class="footer">
  This is a CodePen version of "The perfect biutton", made by 
  <a href="https://twitter.com/vinchubang" class="link-label" target="_blank">
    Vincent Bidaux</a>
  using
  <a href="https://webflow.com/website/The-Green-Print-Button" class="link-label" target="_blank">
    Webflow</a>. 
  Icons © <a href="http://www.streamlineicons.com/" class="link-label" target="_blank">Webalys</a>.
</div>
            
          
!
            
              body {
  overflow: hidden;
}

/* The button properties */

.the-click-button {
  background-color: rgba(255, 80, 53, 0.901961);
  background-image: url(https://daks2k3a4ib2z.cloudfront.net/553f831feb855b6a5f0e42a8/5853beacc62327483d8324b7_mouse%205.svg), url(https://daks2k3a4ib2z.cloudfront.net/553f831feb855b6a5f0e42a8/5853beac5b991c28512ad40b_mouse1.svg);
  background-position: 20px -12px, 20px 4px;
  background-repeat: no-repeat;
  background-size: 22px, 22px;
  border-radius: 3px;
  box-sizing: border-box;
  color: rgb(255, 255, 255);
  cursor: auto;
  display: inline-block;
  font-family: Montserrat, sans-serif;
  font-size: 18px;
  font-weight: normal;
  height: 64px;
  line-height: 24px;
  padding: 20px 30px 20px 60px;
  text-align: left;
  text-decoration: none;
  text-shadow: rgba(0, 0, 0, 0.270588) 0px 1px 0px;
  text-size-adjust: 100%;
  transition-delay: 0s, 0s, 0s, 0s;
  transition-duration: 0.2s, 0.2s, 0.2s, 0.2s;
  transition: color 200ms ease, background-color 200ms ease, opacity 200ms ease, background-position 200ms ease, transform 50ms ease, -webkit-transform 50ms ease;
-webkit-touch-callout: none; /* iOS Safari */ -webkit-user-select: none; /* Chrome/Safari/Opera */ -moz-user-select: none; /* Firefox */ -ms-user-select: none; /* Internet Explorer/Edge */
}

.the-click-button:hover {
    background-color: #27ae60;
    background-position: 20px 9px, 20px 11px;
    color: #fff;
    text-decoration: none;
}

.the-click-button:active {
    background-color: #19da6a;  
    background-image: url(https://daks2k3a4ib2z.cloudfront.net/553f831feb855b6a5f0e42a8/5853beac0f691332411a554c_mouse%204.svg), url(https://daks2k3a4ib2z.cloudfront.net/553f831feb855b6a5f0e42a8/5853beacc62327483d8324b7_mouse%205.svg);
    background-position: 20px 46%, 20px 5px;
    background-size: 22px, 22px;
    background-repeat: no-repeat, no-repeat;
    transform: scale(0.992);
}


/* The following code is for pen layout only */

#stage {
    height:94vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer{
  width:100%;
  text-align:center;
  font-family:Arial, Helvetica;
  font-size:0.8em;
  color:#4A4A4A;
  display:block;
}

a.link-label {
  color:rgba(255, 80, 53, 0.901961);
  text-decoration:none;
}

a.link-label:hover {
  text-decoration:underline;
}
            
          
!
            
              document.addEventListener("DOMContentLoaded", function(event) {
  
  var audioClick = document.querySelector('#clickSound');
  var audioClickUp = document.querySelector('#clickUpSound');
  var audioWoosh = document.querySelector('#wooshSound');
  var audioWooshOut = document.querySelector('#wooshSoundOut');
  
  var clickMe = document.querySelectorAll('.the-click-button');
   
  for (var i=0; i<clickMe.length; i++) {
       var s=clickMe[i]
       
       s.addEventListener('mousedown', function() {
         audioClick.currentTime = 0;
         audioClick.play();
       });
    
       s.addEventListener('mouseup', function() {
         audioClickUp.currentTime = 0;
         audioClickUp.play();
       });
    
       s.addEventListener('mouseenter', function() {
         audioWoosh.currentTime = 0;
         audioWoosh.play();
       });
         
       s.addEventListener('mouseleave', function() {
         audioWooshOut.currentTime = 0;
         audioWooshOut.play();
       });
   }
});
            
          
!
999px
Loading ..................

Console