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 class="maxcontainer">
  <div class="thebutton progressive">
    <div class="box buttonbox">
      <div class="button-dash-container">
        <div class="button-dash">
          <svg>
            <rect x="0" y="0" fill="none" width="100%" height="100%"></rect>
          </svg> Button
        </div>

        <div class="button-dash small-dash">
          <svg>
            <rect x="0" y="0" fill="none" width="100%" height="100%"></rect>
          </svg> 
          Button
        </div>
      </div>
    </div>
  </div>

  <div class="thebutton info">
    <div class="boxinformation">
      <h1>SVG Dasharray</h1>
      <p>Opera de Paris flexin their svg stroke dasharray skills.</p>
      <p>There are so many fun possibilites with this technique and a great use of it here. I'm not quiet sure how they measure the dashoffest + dasharray to get the top effect. Perhaps its a bit of understanding how it works plus some tweaking? Let me know if you have any insight.</p>
      
      <p>See the original hovers
        <a target="_blank" href="https://fauteuils.operadeparis.fr/en">over here</a>.
      </p>
    </div>

  </div>

</div>
            
          
!
            
              /*** Button Code ****/
.button-dash {
  position: relative;
  width: 222px;
  height: 70px;
  padding: 24px 50px;
  font-size: 11px;
  text-transform: uppercase;
  font-size: 16px;
  line-height: 1.6em;
  letter-spacing: .16em;
  color: #fff;
  text-align: center;
  margin: 0 auto 20px auto;
  box-sizing: border-box;
}

.button-dash svg {
  height: 70px;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
}

.button-dash.small-dash svg rect {
  stroke-dasharray: 2 2;
}

.button-dash rect {
  fill: none;
  stroke-width: 2;
  stroke-dasharray: 584, 0;
  transition-property: all;
  transition-duration: .6s;
  transition-timing-function: ease;
  stroke: #fff;
}

.button-dash.small-dash:hover rect {
  stroke-width: 2;
  stroke-dashoffset: 48;
  transition: all 1.35s cubic-bezier(.19, 1, .22, 1);
}

.button-dash:hover rect {
  stroke-width: 5;
  stroke-dasharray: 15, 432;
  stroke-dashoffset: 48;
  transition: all 1.35s cubic-bezier(.19, 1, .22, 1);
}

/*** Container ****/

.button-dash-container {
  position: absolute;
  height: 160px;
  top: 50%;
  transform: translateY(-50%);
  left: 0;
  right: 0;
  margin: auto;
}

.box.buttonbox {
  background: #f2c4a9;
}

/********* Foundation Code *********/
body {
  background-color: #f4f4f4;
  font-family: "Roboto", sans-serif;
}

a {
  text-decoration: none;
}

.maxcontainer {
  width: 100%;
  max-width: 1100px;
  margin: auto;
  overflow: auto;
}

@media screen and (min-width: 750px) {
  .maxcontainer {
    padding: 0;
  }
}

.thebutton {
  float: left;
  width: 95%;
  margin: 2.5% 2.5% 0 2.5%;
  position: relative;
  border-radius: 2px;
  overflow: hidden;
  -webkit-box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.1);
  -moz-box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.1);
  box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.1);
}

@media screen and (min-width: 750px) {
  .thebutton {
    width: 47.5%;
    margin: 2.5% 1.25% 0 1.25%;
  }
}

.box {
  overflow: hidden;
  width: 100%;
  margin: auto;
  height: 0;
  position: relative;
  padding-bottom: 70%;
}

@media screen and (min-width: 650px) {
  .box {
  }
}

.boxinformation {
  background: none;
  color: #000;
  font-weight: 200;
  width: 100%;
  margin: auto;
  position: relative;
}

.boxinformation a {
  color: #000;
  opacity: .4;
  font-weight: bold;
  text-decoration: underline;
}
.boxinformation a:hover {
  opacity: 1;
}

.thebutton.info {
  -webkit-box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0);
  -moz-box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0);
  box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0);
}

            
          
!
999px
Loading ..................

Console