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">
            <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/divinity-medium.png" alt="Divinity" class="responsive-img">

        </div>
    </div>
  </div>
  <div class="news-item standard-item">
    <div class="thumbnail">
      <div class="image-wrapper">
        <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/re7-chris-large.jpg" alt="Resident Evil 7" class="responsive-img">
      </div>
    </div>
  </div>
  <div class="news-item standard-item">
    <div class="thumbnail">
      <div class="image-wrapper">
         <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/bioshock-large.jpg" alt="Bioshock 2" class="responsive-img">
      </div>
    </div>
  </div>
  <div class="news-item standard-item">
    <div class="thumbnail">
      <div class="image-wrapper">
          <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/lara-small.jpg" alt="Tomb Raider" class="responsive-img">
      </div>
    </div>
  </div>
  <div class="news-item standard-item">
    <div class="thumbnail">
      <div class="image-wrapper">
          <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/dishonored-2-medium.jpg" alt="Dishonored 2" class="responsive-img">
      </div>
    </div>
  </div>
  <div class="news-item standard-item">
    <div class="thumbnail">
      <div class="image-wrapper">
        <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/infinite-small.jpg" alt="Bioshock Infinite" class="responsive-img">
      </div>
    </div>
  </div>
  <div class="news-item standard-item">
    <div class="thumbnail">
      <div class="image-wrapper">
        <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/trine-2-large.png" alt="Trine 2" class="responsive-img">
      </div>
    </div>
  </div>
  
   <div class="news-item standard-item">
    <div class="thumbnail">
      <div class="image-wrapper">
         <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/trine-2-large.png" alt="Trine 2" class="responsive-img">
      </div>
    </div>
  </div>
  
   <div class="news-item standard-item">
    <div class="thumbnail">
      <div class="image-wrapper">
        <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/53819/wild-hunt-large.jpg" alt="Wild Hunt" class="responsive-img" />
      </div>
    </div>
  </div>
</div>
            
          
!
            
              * {
  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: 5px auto;
  font-size: 0; // inline-block hack 
  display: grid;
  grid-gap: 3px;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(4, 1fr);
  grid-template-areas: 
      "hero med1"
      "small1 small2"
      "small3 small4"
      "small5 small6";
  
  @media (min-width: 710px) {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(5, 1fr);
    grid-template-areas: 
     "small1  small2  hero hero"
      "med1   med1     hero hero"
      "med1   med1     hero hero"
      "small3 small4   small5 small6";
  }

  @media (min-width: 1100px) {
     grid-template-columns: repeat(5, 1fr);
     grid-template-rows: repeat(4, 1fr);
     grid-template-areas: 
      "small1  small2  hero hero hero"
      "med1   med1     hero hero hero"
      "med1   med1     hero hero hero"
      "small3 small4   small5 small6 small7";
  }
}


.hero-item {
  grid-area: hero;
}

.standard-item:nth-child(2) {
  grid-area: med1; 
}

.standard-item:nth-child(3) {
  grid-area: small5;
}

.standard-item:nth-child(4) {
  grid-area: small1;
}

.standard-item:nth-child(5) {
  grid-area: small2;
}

.standard-item:nth-child(6) {
  grid-area: small3;
}

.standard-item:nth-child(7) {
  grid-area: small4;
}

.standard-item:nth-child(8) {
  grid-area: small6;
}

.standard-item:nth-child(9) {
  grid-area: small7;
  display: none;
  
  @media (min-width: 1100px) {
    display: block;
  }
}


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

.caption {
  padding: 16px;
}
.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;
}


// 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,
.standard-item { 
  width: 50%;
  
  @media (min-width: 710px) {
    width: 25%;
  }
}

/* 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;
    width: auto;
  }
  
  // ensure image extends to the entire grid height
  .hero-item,
  .standard-item:nth-child(2) {
    .responsive-img,
    .image-wrapper,
    .thumbnail {
      height: 100%;
    }
    
    .image-wrapper,
    img {
      position: absolute;
      top: 0;
      bottom: 0;
      right: 0;
      left: 0;
    }
  }
}

            
          
!
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