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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML

              
                <div class="container">
  
  <div class="envelope">
    
    <!--
    <div class="envFace front">
      <h1>To: Receipient's Name</h1>
    </div>
    -->
    <!--
    <div class="envFace back back1">
      <div class="top">
        <div class="outer">
          <div class="inner"></div>
        </div>
      </div>
    </div>
    -->
    
    <div class="card">
      <div class="outer">
        <div class="cardFace outerBG"></div>
        <div class="cardFace outerBlank"></div>
      </div>

      <div class="inner">
        <div class="cardFace innerBG">
          <div class="greetings">
            <div class="content">
              <h2>Dear Receipient</h2>
              <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
              <p>Regards,<br />Sender</p>
              <div class="btn-reply">
                 <a href="">Reply</a>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    
    <!--
    <div class="envFace back back2">
      
      <div class="bottom"></div>
      <div class="left"></div>
      <div class="right"></div>
      <div class="cover"></div>
    </div>
    -->
  </div>
  
</div>

              
            
!

CSS

              
                .container{
  width:960px;
  height:500px;
  position:absolute;
  top:0;
  bottom:0;
  left:0;
  right:0;
  margin: auto;
  cursor:pointer;
  -webkit-font-smoothing:antialiased;
}

.envFace{
  position:absolute;
  width:100%;
  height:500px;
  /*overflow:hidden;*/
}

.front{
  background: #CCCCCC;
  display: table;
}

.front h1 {
  display: table-cell;
  text-align: center;
  vertical-align: middle;
}

.back1 {
    z-index: 30;
}

.back2 {
    z-index: 20;
}

.back .top {
		position: absolute;
		top: -10px;
		left: 0px;
		width: 100%;
		height: 300px;
		z-index: 30;
		overflow: hidden;
}

.back .outer {
		position: absolute;
		bottom: 0;
		left: -100px;
		border-left: 580px solid transparent;
		border-right: 580px solid transparent;
		border-top: 300px solid #EEE;
}
.back .outer .inner {
		position: absolute;
		left: -550px;
		bottom: 20px;
		border-left: 550px solid transparent;
		border-right: 550px solid transparent;
		border-top: 280px solid #333;
}
.back .bottom {
		position: absolute;
		z-index: 20;
		bottom: 0px;
		left: 20px;
		border-left: 460px solid transparent;
		border-right: 460px solid transparent;
		border-bottom: 245px solid #333;
}
.back .left {
		position: absolute;
		z-index: 10;
    bottom: 10px;
		left: 0px;
		border-left: 480px solid #333;
		border-top: 200px solid transparent;
		border-bottom: 255px solid #EEE;
}
.back .right {
		position: absolute;
		z-index: 10;
		bottom: 10px;
		right: 0px;
		border-right: 480px solid #333;
		border-top: 200px solid transparent;
		border-bottom: 255px solid #EEE;
}

.card {
    position: absolute;
		min-height: 500px;
		width: 100%;
		top: 0px;
		left: 0px;
    z-index: 10;
}

.card .outerBlank {
    background: #cccccc;
}


.cardFace {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: visible;
    -webkit-transition: all 0.5s ease-out;
    -webkit-transform-origin: 0 0;
}

.card .outerBG {
    background: #ff0000;
    z-index: 3;
}

.card .outerBlank {
  z-index: 2;
}

.card .innerBG {
  background: #0024ff;
  z-index: 1;
}

.greetings {
    position: relative;
    height: 500px;
    width: 55%;
    margin: auto;
}

.content {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 50px auto;
    padding: 20px;
    background: rgba(54, 20, 0, 0.85);
    color: #FFFFFF;
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    border-radius: 10px;
}

.btn-reply {
    text-align: center;
    margin: 30px 0 0 0;
}

.btn-reply a {
    background: rgba(54, 20, 0, 1);
    color: #FFFFFF;
    font-weight: bold;
    padding: 10px 30px;
    text-decoration: none;
    display: inline-block;
}
              
            
!

JS

              
                var tl = new TimelineMax();

var $container = $(".container"),
    $envelope = $(".envelope"),
    $envFront = $(".front"),
    $envBack = $(".back"),
    $envBack1 = $(".back1"),
    $envBack2 = $(".back2"),
    $topFlap = $(".top"),
    $card = $(".card"),
    $outerBG = $(".outerBG"),
    $outerBlank = $(".outerBlank"),
    $innerBG = $(".innerBG"),
    $greetings = $(".greetings"),
    $window = $(window);

    

tl.set($container, {perspective:1100})
  .set($envelope, {transformStyle:"preserve-3d"})
  .set($envBack, {rotationY:-180})
  .set([$envBack, $envFront], {backfaceVisibility:"hidden"})
  .set([$envBack, $envFront, $card], {scale: 0.6})
  .set($topFlap, {transformOrigin: "center top"})
  .set($card, {rotationY: -180, autoAlpha: 1})
  .set($outerBG, {backfaceVisibility:"hidden"})
  .set($greetings, {autoAlpha: 0});




$container.click(function(){
    tl.to([$outerBG, $outerBlank], 1, {rotationX: -165});
  
  $card.mousemove(function(event) {
        cx = Math.ceil($container.width() / 2.0);
        cy = Math.ceil($container.height() / 2.0);
        dx = event.pageX - cx;
        dy = event.pageY - cy;

        tiltx = (dy / cy);
        tilty = - (dx / cx);
        radius = Math.sqrt(Math.pow(tiltx,2) + Math.pow(tilty,2));
        degree = (radius * 20);
        TweenLite.set($envelope, {transform:'rotate3d(' + tiltx + ', ' + tilty + ', 0, ' + degree + 'deg)'});
//        $('#picture').css('-webkit-transform','rotate3d(' + tiltx + ', ' + tilty + ', 0, ' + degree + 'deg)');
    });
});






              
            
!
999px

Console