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

            
              <main>
  <transition name="button">
    <button @click="toggleModal()" v-show="!showModal"><i class="fa fa-2x fa-id-card-o"></i></button>
  </transition>
  
    <!--  The Modal -->
  <modal v-if="showModal" :flip-me="flipMe" @toggle="toggleModal()">
    <div slot="front-header">
      <b>Gimme the Keys</b>
    </div>
    <div slot="front-body">
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tenetur quia totam velit amet porro libero ab blanditiis fugiat repudiandae, aperiam, quod ut odit cumque eos modi doloremque laborum delectus commodi!
    </div>
    <div slot="front-footer">
      <button @click="flipModal()"><i class="fa fa-arrow-right"></i></button>
<!--       <button @click="toggleModal()">Done</button> -->
    </div>
    <div slot="back-header">
      <b>Flip You Fo Real!</b>
    </div>
    <div slot="back-body">
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reiciendis necessitatibus cumque, quaerat sunt, aliquam, officia ut delectus explicabo laborum distinctio totam tempore debitis. Error odio quidem cupiditate, harum, similique laboriosam.
    </div>
    <div slot="back-footer">
      <button @click="toggleModal()">Done</button>
      <button @click="flipModal()"><i class="fa fa-arrow-left"></i></button>
    </div>
  </modal>

</main>
            
          
!

CSS

            
              :root {
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  &__wrapper {
    position: relative;
    width: 65vmin;
    height: 35vmin;
    min-height: 15em;
    min-width: 20em;
    display: flex;
  }
  &__container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    color: #333;
    border-radius: .2em;
    box-shadow: 0 0 0 1px rgba(0,0,0,.2), 0 1em 2em -1em;
  }
  &__header {
    flex: none;
    display: flex;
    justify-content: space-between;
    padding: 1em;
  }
  &__body {
    flex: 1;
    padding: 1em;
    overflow: auto;
  }
  &__footer {
    flex: none;
    padding: 1em;
    > * {
      flex-direction: row-reverse;
      display: flex;
      justify-content: space-between;
    }
  }
  &__x {
    cursor: pointer;
    font-size: 2em;
    line-height: .5;
  }
}

.button-leave-active,
.modal-enter-active {
  transition: transform 500ms cubic-bezier(1, 0, 0.2, 1.5);
}
.modal-leave-active,
.button-enter-active {
  transition: transform 500ms cubic-bezier(1, -0.5, 0.2, 1);
}

.mask-enter-active, .mask-leave-active {
  transition: opacity 300ms linear;
}
.mask-enter, .mask-leave-to {
  opacity: 0;
}

.button-enter, .button-leave-to,
.modal-enter, .modal-leave-to {
  transform: scale(0);
}


// flipper
.flip-container {
  perspective: 900;
  &.flip-me .flipper {
    transform: rotateY(-180deg);
  }
}
.flipper {
  will-change: transform;
  transition: transform 1000ms cubic-bezier(1, -0.2, 0.2, 1.2);
  transform-style: preserve-3d;
  position: relative;
  transform: rotateY(0);
  .front,
  .back {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }
  .front {
    transform: rotateY(0deg);
  }
  .back {
    transform: rotateY(-180deg);
  }
}

// boring
[v-cloak] {
  display: none !important;
}

*, *::before, *::after {box-sizing: border-box;}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: sans-serif;
  background: #21c2f5; //#9ccf5e;
  color: #fff;
}

button {
  border: none;
  box-shadow: 0 0 0 2px rgba(0,0,0,.2) inset;
  padding: .7em 1em;
  border-radius: .35em;
  color: #fff;
  font: inherit;
  background: #333;
  cursor: pointer;
  outline: none;
  will-change: transform;
  transition: transform .2s ease-out;
  &:active {
    transform: scale(.9);
  }
}
            
          
!

JS

            
              Vue.component('modal', {
  template: `
    <transition name="modal">
      <div class="modal flip-container" :class="{'flip-me': flipMe}">
        <div class="modal__wrapper flipper">
          <div class="modal__container front">
            <div class="modal__header">
              <slot name="front-header"></slot>
              <div class="modal__x" @click="$emit('toggle')">&times;</div>
            </div>
            <div class="modal__body">
              <slot name="front-body"></slot>
            </div>
            <div class="modal__footer">
              <slot name="front-footer"></slot>
            </div>
          </div>
          <div class="modal__container back">
            <div class="modal__header">
              <slot name="back-header"></slot>
              <div class="modal__x" @click="$emit('toggle')">&times;</div>
            </div>
            <div class="modal__body">
              <slot name="back-body"></slot>
            </div>
            <div class="modal__footer">
              <slot name="back-footer"></slot>
            </div>
          </div>
        </div>
      </div>
    </transition>
  `,
  props: [
    'flipMe'
  ]
})

new Vue({
  el: 'main',
  data: {
    showModal: true,
    flipMe: false
  },
  methods: {
    toggleModal: function() {
      this.showModal = !this.showModal
    },
    flipModal: function() {
      this.flipMe = !this.flipMe
    }
  }
})
            
          
!
999px

Console