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.

            
              <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>
            
          
!
            
              // ******************************
// Normalize (ignore me!)
// ******************************
@import "compass";
@import "compass/css3";
@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;
  }
}
// ******************************
// End of Normalize
// ******************************

// ******************************
// 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%);
  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;
  }
}
            
          
!
            
              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
Loading ..................

Console