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 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

              
                <article>
  <div class="item-wrapper">
    <figure>
      <div class="image" style="background-image:url(https://drive.google.com/uc?export=view&id=0B_koKn2rKOkLR0dpLWJDU3lMc28);"></div>
      <div class="lighting"></div>
    </figure>
    <div class="item-content">
      <h1>First Article Title</h1>
      <p>Lorem ipsum dolor sit amet consectetuer adipiscing elit</p>
      <div class="author">Jordan Quinn</div>
    </div>
  </div>
</article>
<article>
  <div class="item-wrapper">
    <figure>
      <div class="image" style="background-image:url(https://drive.google.com/uc?export=view&id=0B_koKn2rKOkLRmNpcE93R2YtcEE);"></div>
      <div class="lighting"></div>
    </figure>
    <div class="item-content">
      <h1>Second Article Title</h1>
      <p>Donec pede justo fringilla vel aliquet nec vulputate eget arcu</p>
      <div class="author">Edna Hardy</div>
    </div>
  </div>
</article>
<article>
  <div class="item-wrapper">
    <figure>
      <div class="image" style="background-image:url(https://drive.google.com/uc?export=view&id=0B_koKn2rKOkLWTl4V183QkdOZG8);"></div>
      <div class="lighting"></div>
  </figure>
    <div class="item-content">
      <h1>Third Article Title</h1>
      <p>In enim justo rhoncus ut imperdiet a venenatis vitae justo</p>
      <div class="author">Kayla	Beck</div>
    </div>
  </div>
</article>
              
            
!

CSS

              
                @import url(//fonts.googleapis.com/css?family=Lato:300);
$fonts:Lato,Arial,"Hiragino Kaku Gothic Pro W3",Meiryo,sans-serif;
$bg_color:#f1f1f1;
$font_color:#464646;
$link_color:#555;
$link_hover_color:#444;

* {
  margin:0;
  padding:0;
  box-sizing:border-box;
  &:before,
  &:after{
    box-sizing:border-box;
    padding:0;
    margin:0;
  }
}
body{
  font-family:$fonts;
  background-color:$bg_color;
  color: $font_color;
  text-align: center;
  margin: 0 auto;
  a, a:visited{
    color: $link_color;
    text-decoration:none;
  }
  a:hover{
    color: $link_hover_color;
  }
}

// ******************************
// Common extend
// ******************************
%fit_obj{
  position:absolute;
  top:0;
  left:0;
  width:100%;
  height:100%;
}
%backface_visibility_hidden{
  backface-visibility: hidden;
}
%preserve_3d{
  transform-style: preserve-3d;
};
// ******************************

article{
  position:relative;
  display:inline-block;
  vertical-align:top;
  width:calc(33.33% - 4.6%);
  height:24vw;
  margin:1.8%;
  perspective:1600px;
  cursor:pointer;
  
  .item-wrapper{
    width:100%;
    height:100%;
    box-shadow:0 0 4px rgba(#000, 0.1);
    @extend %preserve_3d;
    @extend %backface_visibility_hidden;
    // Shadow
    &::before{
      content:'';
      position:absolute;
      top:5%;
      left:5%;
      width:90%;
      height:90%;
      transition:all .2s ease-in;
      box-shadow:0 8px 38px rgba(#000, 0.86);
    }
    &:hover{
      &::before{
        box-shadow:0 14px 64px rgba(#000, 0.92);
      }
    }
    &.enter.ease,
    &.leave{
      transition:all .1s ease-in;
    }
  }
  figure{
    width:100%;
    height:100%;
    @extend %preserve_3d;
    &::after{
      @extend %fit_obj;
      content:'';
      background-color:rgba(#000, 0.06);
    }
    // Thumbnail
    .image{
      @extend %fit_obj;
      background-position:center;
      background-size:cover;
    }
    // Gradient filter
    .lighting{
      @extend %fit_obj;
      background:linear-gradient(135deg, rgba(#fff, 0.24) 0%, rgba(#fff, 0) 100%);
    }
  }
  // Title, description
  .item-content{
    pointer-events:none;
    padding:20% 20px 20px;
    color:#fff;
    text-shadow:0 3px 10px rgba(#000, .76);
    @extend %fit_obj;
    @extend %backface_visibility_hidden;
    @extend %preserve_3d;

    h1{
      margin-bottom:5%;
      transform: translateZ(100px);
    }
    p {
      font-size:13px;
      margin-bottom:5%;
      transform: translateZ(50px);
    }
    .author{
      transform:translateZ(70px)
    }
  }
}

// Mediaqueries
@media ( max-width : 860px ){
  // set to 2 column
  article{
    width:calc(50vw - 3.9vw);
    height:38vw;
  }
}
@media ( max-width : 667px ){
  // set to 1 column
  article{
    width:calc(100vw - 3.9vw);
    height:60vw;
  }
}
              
            
!

JS

              
                var articles = $('article > .item-wrapper'),
    lightingRgb = '255,255,255';

articles.mousemove(function(e) {
  var current = $(this),
      x = current.width() - e.offsetX * 2,
      y = current.height() - e.offsetY * 2,
      rx = -x / 30,
      ry = y / 24,
      deg = Math.atan2(y, x) * (180 / Math.PI) + 45;
  current.css({"transform":"scale(1.05) rotateY("+rx+"deg) rotateX("+ry+"deg)"});
  $('figure > .lighting',this).css('background','linear-gradient('+deg+'deg, rgba('+lightingRgb+',0.32) 0%, rgba('+lightingRgb+',0) 100%)');
});

articles.on({
  'mouseenter':function() {
    var current = $(this);
    current.addClass('enter ease').removeClass("leave");
    setTimeout(function(){
      current.removeClass('ease');
    }, 280);
  },
  'mouseleave':function() {
    var current = $(this);
    current.css({"transform":"rotate(0)"});
    current.removeClass('enter').addClass("leave");
    $('figure > .lighting',this).removeAttr('style');
  }}
);
              
            
!
999px

Console