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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

            
              <div class="wrapper">
  <div class="news-item hero-item">
    <div class="thumbnail">
        <div class="image-wrapper">
           <picture>
            <!--[if IE 9]><video style="display: none;"><![endif]-->
            <source media="(max-width: 599px)" srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/divinity-small.jpg">
            <source media="(min-width: 600px)" srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/divinity-ori-sin.jpg">
            <!--[if IE 9]></video><![endif]-->
            <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/divinity-ori-sin.jpg" alt="Divinity" class="responsive-img">
          </picture>
        </div>
        <div class="caption">
          <span class="tag">Review</span>
          <h1 class="title">Divinity: Original Sin 2 is awesome</h1>
          <span class="author">by Ren Aysha</span>
        </div> 
    </div>
  </div>
  <div class="news-item standard-item">
    <div class="thumbnail">
      <div class="image-wrapper">
        <picture>
          <!--[if IE 9]><video style="display: none;"><![endif]-->
          <source media="(max-width: 599px)" srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/re7-chris-large.jpg">
          <source media="(min-width: 600px)" srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/re7-chris-small.jpg">
          <!--[if IE 9]></video><![endif]-->
          <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/re7-chris-large.jpg" alt="Resident Evil 7" class="responsive-img">
        </picture>
      </div>
      <div class="caption">
        <span class="tag">Featured</span>
        <h1 class="title">Resident Evil 7: Scarier than ever</h1>
        <span class="author">by Ren Aysha</span>
      </div> 
    </div>
  </div>
  <div class="news-item standard-item">
    <div class="thumbnail">
      <div class="image-wrapper">
        <picture>
          <!--[if IE 9]><video style="display: none;"><![endif]-->
          <source media="(max-width: 599px)" srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/bioshock-large.jpg">
          <source media="(min-width: 600px)" srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/bioshock-small.jpg">
          <!--[if IE 9]></video><![endif]-->
          <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/bioshock-large.jpg" alt="Bioshock 2" class="responsive-img">
        </picture>
      </div>
      <div class="caption">
        <span class="tag">Guide</span>
        <h1 class="title">Bioshock 2: Tactics on killing Big Sisters</h1>
        <span class="author">by Ren Aysha</span>
      </div> 
    </div>
  </div>
  <div class="news-item standard-item">
    <div class="thumbnail">
      <div class="image-wrapper">
        <picture>
          <!--[if IE 9]><video style="display: none;"><![endif]-->
          <source media="(min-width: 1100px)" srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/lara-large.jpg">
          <source media="(min-width: 728px)" srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/lara-small.jpg">
          <source media="(min-width: 600px)" srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/lara-large.jpg">
          <!--[if IE 9]></video><![endif]-->
          <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/lara-large.jpg" alt="Tomb Raider" class="responsive-img">
        </picture>
      </div>
      <div class="caption">
        <span class="tag">Adventure</span>
        <h1 class="title">Tomb Raider: The reincarnation of Lara Croft</h1>
        <span class="author">by Ren Aysha</span>
      </div> 
    </div>
  </div>
  <div class="news-item standard-item">
    <div class="thumbnail">
      <div class="image-wrapper">
        <picture>
          <!--[if IE 9]><video style="display: none;"><![endif]-->
          <source media="(min-width: 1100px)" srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/dishonored-small.jpg">
          <source media="(min-width: 728px)" srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/dishonored-large.jpg">
          <source media="(min-width: 600px)" srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/dishonored-small.jpg">
          <!--[if IE 9]></video><![endif]-->
          <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/dishonored-small.jpg" alt="Dishonored 2" class="responsive-img">
        </picture>
      </div>
      <div class="caption">
        <span class="tag">Stealth</span>
        <h1 class="title">Dishonored 2: Creative Kills have never look so good</h1>
        <span class="author">by Ren Aysha</span>
      </div> 
    </div>
  </div>
  <div class="news-item standard-item">
    <div class="thumbnail">
      <div class="image-wrapper">
        <picture>
          <!--[if IE 9]><video style="display: none;"><![endif]-->
          <source media="(min-width: 1100px)" srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/infinite-large.jpg">
          <source media="(min-width: 600px)" srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/infinite-small.jpg">
          <!--[if IE 9]></video><![endif]-->
          <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/infinite-large.jpg" alt="Bioshock Infinite" class="responsive-img">
        </picture>
      </div>
      <div class="caption">
        <span class="tag">First person shooter</span>
        <h1 class="title">Bioshock Infinite: Colorful instead of morbid</h1>
        <span class="author">by Ren Aysha</span>
      </div> 
    </div>
  </div>
  <div class="news-item standard-item">
    <div class="thumbnail">
      <div class="image-wrapper">
        <picture>
          <!--[if IE 9]><video style="display: none;"><![endif]-->
          <source media="(max-width: 599px)" srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/trine-2-large.png">
          <source media="(min-width: 600px)" srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/trine-2-small.png">
          <!--[if IE 9]></video><![endif]-->
          <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/trine-2-large.png" alt="Trine 2" class="responsive-img">
        </picture>
      </div>
      <div class="caption">
        <span class="tag">Review</span>
        <h1 class="title">Trine 2: Entertaining & Funny</h1>
        <span class="author">by Ren Aysha</span>
      </div> 
    </div>
  </div>
  
  <div class="news-item standard-item">
    <div class="thumbnail">
      <div class="image-wrapper">
        <picture>
          <!--[if IE 9]><video style="display: none;"><![endif]-->
          <source media="(max-width: 599px)" srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/wild-hunt-large.jpg">
          <source media="(min-width: 600px)" srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/wild-hunt-small.jpg">
          <!--[if IE 9]></video><![endif]-->
          <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/wild-hunt-large.jpg" alt="Witcher 3: Wild Hunt" class="responsive-img">
        </picture>
      </div>
      <div class="caption">
        <span class="tag">Adventure</span>
        <h1 class="title">Witcher 3: Blood and Wine</h1>
        <span class="author">by Ren Aysha</span>
      </div>
    </div>
  </div>
</div>
            
          
!
            
              @mixin text-pullout() {
  .caption {
    position: static;
    margin-right: auto;
  }
  
  .thumbnail,
  .responsive-img,
  .image-wrapper {
    height: auto;
  }
  
  .title,
  .author {
    color: #333;
  }  
}

@mixin image-full-bleed() {
  .image-wrapper,
  picture,
  img {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }
}

* {
  box-sizing: border-box;
  position: relative;
}

body {
  margin: 0 3px;
  font-family: 'Lato', sans-serif;
}

img {
  display: block;
  object-fit: cover;
}


.wrapper {
  max-width: 1440px;
  margin: 3px auto;
  font-size: 0; // inline-block hack 
  display: grid;
  grid-gap: 3px;
  
  @media (min-width: 600px) {
    grid-template-columns: repeat(2, 1fr);
  }
  
  @media (min-width: 710px) {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Styles related to the thumbnails */
.responsive-img {
  max-width: 100%;
  height: auto;
  width: 100%;
}

.caption {
  position: absolute;
  bottom: 0;
  padding: 16px;
  z-index: 3;
  left: 0;
}

.title,
.tag {
  text-transform: uppercase;
  letter-spacing: 1px;
}

.title {
  font-size: 1.1em;
  font-weight: bold;
  margin-bottom: 4px;
  line-height: 1.35em;
}

.tag {
  background: #ff0052;
  padding: 4px 8px;
  display: inline-block;
  margin-bottom: 8px;
  font-size: 12px;
}

.thumbnail {
  color: #fff;
  position: relative;
  overflow: hidden;
}

.image-wrapper {
  &:after {
    background: -webkit-gradient(
      linear,
      left bottom,
      left top,
      color-stop(1, rgba(0,0,0,0.0)), /* Top */
      color-stop(0, rgba(0,0,0,1.0)) /* Bottom */
    );
    bottom: 0;
    content: "";
    left: 0;
    opacity: .5;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 2;
  }
}

.news-item {
  display: inline-block; // display: inline-block for non supported browsers
  vertical-align: top;
  font-size: 16px;
  padding: 2px;
  position: relative;
  
  @media (min-width: 710px) {
    &:first-child {
      &:before {
        display: block;
        width: 0;
        height: 0;
        border: 0 solid transparent;
        border-right-color: #fff;
        border-width: 0 55px 55px 0;
        content: "";
        position: absolute;
        right: 0;
        top: 0;
        z-index: 5;
      }
    }
  }
}

.hero-item,
.standard-item {
  width: 100%;
}

// Classes under media queries will have a mix of percentage
// based width and grid columns. Grid code will be ignored for
// unsupported browsers and percentage is used. Percentage width
// will be overwritten by supported browsers when grid is used.
.hero-item {  
  @media (min-width: 600px) {
    grid-column: 1 / span 2;
  }
  
  @media(min-width: 710px) {
    width: 70%;
    grid-column: 1 / span 3;
  }
}

.standard-item {
  @media (min-width: 600px) {
    width: 50%;
    
    &:nth-child(4) {
      width: 100%;
      grid-column: 1 / span 2;
    }
  }
  
  @media (min-width: 710px) {
    width: 30%;
    
    &:nth-child(2) {
      vertical-align: bottom;
    }
    
    &:nth-child(4),
    &:nth-child(6) {
      width: 40%;
    }
    
    &:nth-child(4) {
      grid-column: 2 / span 2;
    }
    
    &:nth-child(6) {
      grid-column: 1 / span 2;
    }
    
    
    &:nth-child(5) {
      width: 30%;
      grid-column: 4 / span 1;
    }
  }
}

/* For browsers with grid */
// Cleaner code and no more percentage based width
@supports (display: grid) {
  .wrapper > *,
  .standard-item:nth-child(4),
  .standard-item:nth-child(5),
  .standard-item:nth-child(6) {
    margin: 0;
    
    @media (min-width: 600px) {
      width: auto;
    }
  }
  
  .news-item {
    padding: 0;
  }
  
  .standard-item:nth-child(2) {
    @media (min-width: 710px) {
      border-top: 55px solid #fff;
    }
  }
 
  .caption {
    position: static;
    margin-right: auto;
  }
  
  .title,
  .author {
    color: #333;
  }
  
  // media queries in order to simulate
  // polygon's layout in different widths
  // some repeated code is necessary
   @media (min-width: 600px) {
    .hero-item,
    .standard-item:nth-child(4),
    .standard-item:nth-child(5),
    .standard-item:nth-child(6) {
      .thumbnail,
      .responsive-img,
      .image-wrapper {
        height: 100%;
      }

      .responsive-img {
        width: 100%;
      }

      .caption {
        position: absolute;
      }

      .title,
      .author {
        color: #fff;
      }
    }
  }
  
  @media (min-width: 710px) {
    .hero-item,
    .standard-item:nth-child(4),
    .standard-item:nth-child(6) {
      @include image-full-bleed();
    }
    
    .standard-item:nth-child(2) {
      vertical-align: baseline;
    }
  }
  
  
  .standard-item:nth-child(4) {
    @media (max-width: 599px) {
      @include text-pullout();
    }
  }
  
  .standard-item:nth-child(5) {
    @media  (min-width: 710px), (max-width: 709px) {
      @include text-pullout();
    }
  }
  
  .standard-item:nth-child(6) {
    @media (max-width: 709px) {
      @include text-pullout();
    }
  }
}

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console