Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                <div class="page">
  <div class="header">
    <div class="logo">
      <span class="header-logo"></span>
    </div>
    <div class="nav">
      <div class="links">
        <span class="nav-link"></span>
        <span class="nav-link"></span>
        <span class="nav-link"></span>
        <span class="nav-link"></span>
      </div>
      <div id="share" class="share">
        <!-- Where the magic happens -->
        <div class="square"></div>
        <div id="heart" class="heart">
            <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
               viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">
            <path fill="#CD2414" d="M18.5,7.5c0-2.8-2.2-5-5-5c-1.4,0-2.6,0.5-3.5,1.4C9.1,3,7.8,2.5,6.5,2.5c-2.8,0-5,2.2-5,5
              c0,1.4,0.6,2.6,1.5,3.5l7.1,7.1l7.1-7.1l0,0C17.9,10.1,18.5,8.8,18.5,7.5z"/>
            </svg>
        </div>
        <div class="options">
          <div>
              <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
             viewBox="0 0 136.4 238.2" enable-background="new 0 0 136.4 238.2" xml:space="preserve">
              <g>
                <path id="f_1_" fill="#FFFFFF" d="M83.3,228.6v-99.8h33.5l5-38.9H83.3V65.1c0-11.3,3.1-18.9,19.3-18.9l20.6,0V11.4
                  c-3.6-0.5-15.8-1.5-30-1.5c-29.7,0-50,18.1-50,51.4v28.7H9.5v38.9h33.6v99.8H83.3z"/>
              </g>
            </svg>
            <!-- Sloppy... I am too lazy to undo what I did to span -->
            <p>LIKE</p>
          </div>
          <div>
          <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
             viewBox="0 0 201.8 165.5" enable-background="new 0 0 201.8 165.5" xml:space="preserve">
          <g>

              <sodipodi:namedview  id="base" inkscape:zoom="3.7200571" inkscape:cy="50.181142" fit-margin-top="0" bordercolor="#666666" pagecolor="#ffffff" inkscape:cx="101.29413" fit-margin-left="0" showgrid="false" borderopacity="1.0" inkscape:window-maximized="1" fit-margin-right="0" fit-margin-bottom="0" inkscape:window-y="-8" inkscape:window-width="1280" inkscape:current-layer="layer1" inkscape:document-units="px" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-x="-8" inkscape:window-height="962">
              </sodipodi:namedview>
            <g id="layer1_1_" transform="translate(-282.32053,-396.30734)" inkscape:label="Layer 1" inkscape:groupmode="layer">
              <path id="path5_1_" inkscape:connector-curvature="0" fill="#FFFFFF" d="M464.7,427.4c-6.3,2.8-13.1,4.7-20.2,5.5
                c7.3-4.4,12.8-11.2,15.5-19.5c-6.8,4-14.3,7-22.3,8.5c-6.4-6.8-15.6-11.1-25.7-11.1c-19.4,0-35.2,15.8-35.2,35.2
                c0,2.8,0.3,5.4,0.9,8c-29.2-1.5-55.2-15.5-72.5-36.8c-3,5.2-4.8,11.2-4.8,17.7c0,12.2,6.2,23,15.7,29.3
                c-5.8-0.2-11.2-1.8-15.9-4.4c0,0.1,0,0.3,0,0.4c0,17,12.1,31.3,28.2,34.5c-3,0.8-6.1,1.2-9.3,1.2c-2.3,0-4.5-0.2-6.6-0.6
                c4.5,14,17.5,24.2,32.9,24.4c-12,9.4-27.2,15.1-43.7,15.1c-2.8,0-5.6-0.2-8.4-0.5c15.6,10,34.1,15.8,53.9,15.8
                c64.7,0,100.1-53.6,100.1-100.1c0-1.5,0-3-0.1-4.6C454.1,440.6,460,434.4,464.7,427.4L464.7,427.4z"/>
            </g>
          </g>
          </svg>

            <!-- Sloppy... I am too lazy to undo what I did to span -->
            <p>TWEET</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                html, body {
  margin: 0;
  padding: 0;
  background-color: #ededed;
  height: 100%;
  width: 100%;
}

.page {
  background-color: #fff;
  width: 50%;
  height: 80%;
  max-height: 400px;
  position: absolute;
  bottom: 0;
  left: 50%;
  margin-left: -25%;
  box-shadow: 0px 0px 100px 0px rgba(0,0,0,0.1);
  background-image: url('https://i.imgur.com/9XVE1C5.jpg');
  background-size: 100%;
}


.header {
  height: 100px;
}
.logo {
  position: relative;
  height: 100%;
  width: 20%;
  float: left;
}
.nav {
  position: relative;
  height: 100%;
  width: 80%;
  background-color: #fff;
  float: left;
}
.nav:after {
  height: 100%;
  width: 10%;
  background-color: #eee;
  position: absolute;
  right: 0;
  display: block;
  content: " ";
}
.links {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding-left: 20px;
}

span {
  border-radius: 20px;
  display: block;
  background-color: #ffffff;
}
.header-logo {
  height: 40%;
  width: 60%;
  margin-top: -10%;
  margin-left: -30%;
  position: absolute;
  top: 50%;
  left: 50%;
}
.nav-link {
  background-color: #808080;
  opacity: 0.25;
  height: 12%;
  width: 8%;
  float: left;
  margin: 20px;
  margin-top: 50px;
  transition: all 0.25s;
}
.nav-link:hover {
  opacity: 0.5;
}



.share {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 10%;
  z-index: 2;
  cursor: pointer;
}

.square {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: #fff;
  transition: all 0.5s;
}
.heart {
  position: absolute;
  top: 50%;
  left: 50%;
  height: 20px;
  width: 20px;
  margin-top: -10px;
  margin-left: -10px;
  z-index: 3;
  transition: all 0.25s;
}
.heart:after {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  margin-top: 0;
  margin-left: 0;
  background-color: #CD2414;
  border: 0px solid #CD2414;
  opacity: 0.4;
  border-radius: 100%;
  content:" ";
  transition: all 0.25s;
}

.share:hover .heart {
  height: 30px;
  width: 30px;
  margin-top: -15px;
  margin-left: -15px;
}

.open:hover .heart {
  height: 30px;
  width: 30px;
  margin-top: -15px;
  margin-left: -15px;
  
  -webkit-animation: SHRINK-HEART 0.25s forwards; /* Safari 4+ */
  -moz-animation:    SHRINK-HEART 0.25s forwards; /* Fx 0.25+ */
  -o-animation:      SHRINK-HEART 0.25s forwards; /* Opera 12+ */
  animation:         SHRINK-HEART 0.25s forwards; /* IE 10+, Fx 29+ */
}
@-webkit-keyframes SHRINK-HEART {
  0%  { height: 30px; width: 30px; margin-top: -15px; margin-left: -15px; }
  100% { height: 20px; width: 20px; margin-top: -10px; margin-left: -10px;}
}
@-moz-keyframes SHRINK-HEART {
  0%  { height: 30px; width: 30px; margin-top: -15px; margin-left: -15px; }
  100% { height: 20px; width: 20px; margin-top: -10px; margin-left: -10px;}
}
@-o-keyframes SHRINK-HEART {
  0%  { height: 30px; width: 30px; margin-top: -15px; margin-left: -15px; }
  100% { height: 20px; width: 20px; margin-top: -10px; margin-left: -10px;}
}
@keyframes SHRINK-HEART {
  0%  { height: 30px; width: 30px; margin-top: -15px; margin-left: -15px; }
  100% { height: 20px; width: 20px; margin-top: -10px; margin-left: -10px;}
}

.open .square {
  transform: rotate(180deg);
  box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.1);
}
.open .heart:after {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin-top: -30px;
  margin-left: -30px;
  background-color: rgba(205,36,20,0.4);
  border: 10px solid #CD2414;
  opacity: 0;
  border-radius: 100%;
  content:" ";
  -webkit-animation: EXPLODE 0.25s forwards; /* Safari 4+ */
  -moz-animation:    EXPLODE 0.25s forwards; /* Fx 0.25+ */
  -o-animation:      EXPLODE 0.25s forwards; /* Opera 12+ */
  animation:         EXPLODE 0.25s forwards; /* IE 10+, Fx 29+ */
}
@-webkit-keyframes EXPLODE {
  0%  { height: 0; width: 0; margin-top: 0; margin-left: 0; opacity: 1; }
  100% { height: 40px; width: 40px; margin-top: -30px; margin-left: -30px; opacity: 0;}
}
@-moz-keyframes EXPLODE {
  0%  { height: 0; width: 0; margin-top: 0; margin-left: 0; opacity: 1; }
  100% { height: 40px; width: 40px; margin-top: -30px; margin-left: -30px; opacity: 0;}
}
@-o-keyframes EXPLODE {
  0%  { height: 0; width: 0; margin-top: 0; margin-left: 0; opacity: 1; }
  100% { height: 40px; width: 40px; margin-top: -30px; margin-left: -30px; opacity: 0;}
}
@keyframes EXPLODE {
  0%  { height: 0; width: 0; margin-top: 0; margin-left: 0; opacity: 1; }
  100% { height: 40px; width: 40px; margin-top: -30px; margin-left: -30px; opacity: 0;}
}


.options {
  width: 100%;
  margin-top: 100px;
  height: 300px;
  text-align: center;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.75em;
}
.options > div {
  background-color: #458AAD;
  width: 100%;
  height: 0px;
  transition: all 0.35s;
  overflow: hidden;
}
.open .options > div {
  height: 82px;
}
.options p {
  margin: 0;
  padding-bottom: 20px;
}
.options svg {
  max-width: 35%;
  max-height: 25px;
  padding-top: 20px
}
.options > div:hover {
  background-color: #67D0F9;
}


              
            
!

JS

              
                // In order to properly reset a run-once CSS animation,
// you have to delete the element and replace it.

$(function() {
    $("#share").click( function() {
        var el = $( this );
        el.hasClass('open') ? el.removeClass('open') : el.addClass('open');
      
      
        //Prepend the clone & then remove the original element
        el = $( "#heart" );
        el.before( el.clone(true) ).remove();
    });
});

// Thanks http://elijahmanor.com/
// https://css-tricks.com/restart-css-animation/#comment-92484
              
            
!
999px

Console