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="grid">
  <h1>Sunday</h1>
  <article style="--background: url(https://images.unsplash.com/photo-1482003297000-b7663a1673f1?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=d1793be993ffb3d86e5538992e28a3c2);">
    <header style="--header-color: #fff; --header-bg: rgba(0,0,0,0.25)">
      <h1>Venenatis Pharetra</h1>
      <h2>Mattis Fringilla Quam</h2>
    </header>
  </article>
  <article style="--background: url(https://images.unsplash.com/photo-1451481086097-f6a15d5f8d18?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=7e747b16c9812fd1b38045a62c3ed6a7);">
    <header style="--header-bg: rgba(255, 255, 255, 0.75);">
      <h1>Venenatis Pharetra</h1>
      <h2>Mattis Fringilla Quam</h2>
    </header>
  </article>
  <article style="--background: url(https://images.unsplash.com/photo-1500285426772-410d8f2243d0?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=2bba485852815ab6dc1deace4b757cc1);">
    <header style="--header-bg: rgba(255, 255, 255, 0.75)">
      <h1>Venenatis Pharetra</h1>
      <h2>Mattis Fringilla Quam</h2>
    </header>
  </article>
  <article style="--background: url(https://images.unsplash.com/photo-1492539161849-b2b18e79c85f?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=367893f5579b880a55a6826a3bf02dd5);">
    <header style="--header-color: #fff">
      <h1>Venenatis Pharetra</h1>
      <h2>Mattis Fringilla Quam</h2>
    </header>
  </article>
  <article style="--background: url(https://images.unsplash.com/photo-1443683263937-3e377546e8a8?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=4d7ff43731c48b2b9ffdc6027accb18d);">
    <header style="--header-color: #fff">
      <h1>Venenatis Pharetra</h1>
      <h2>Mattis Fringilla Quam</h2>
    </header>
  </article>
  <article class="list">
    <p>Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
    <ul>
      <li><img src="" /> <span>Magna</span></li>
      <li><img src="" /> <span>Amet Consectetur</span></li>
      <li><img src="" /> <span>Risus</span></li>
      <li><img src="" /> <span>Quam Euismod Bibendum</span></li>
    </ul>
  </article>
  
  <h1>Saturday</h1>
  <article style="--background: url(https://images.unsplash.com/photo-1482003297000-b7663a1673f1?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=d1793be993ffb3d86e5538992e28a3c2);">
    <header style="--header-color: #fff; --header-bg: rgba(0,0,0,0.25)">
      <h1>Venenatis Pharetra</h1>
      <h2>Mattis Fringilla Quam</h2>
    </header>
  </article>
  <article style="--background: url(https://images.unsplash.com/photo-1451481086097-f6a15d5f8d18?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=7e747b16c9812fd1b38045a62c3ed6a7);">
    <header style="--header-bg: rgba(255, 255, 255, 0.75);">
      <h1>Venenatis Pharetra</h1>
      <h2>Mattis Fringilla Quam</h2>
    </header>
  </article>
  <article style="--background: url(https://images.unsplash.com/photo-1500285426772-410d8f2243d0?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=2bba485852815ab6dc1deace4b757cc1);">
    <header style="--header-bg: rgba(255, 255, 255, 0.75)">
      <h1>Venenatis Pharetra</h1>
      <h2>Mattis Fringilla Quam</h2>
    </header>
  </article>
  <article style="--background: url(https://images.unsplash.com/photo-1492539161849-b2b18e79c85f?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=367893f5579b880a55a6826a3bf02dd5);">
    <header style="--header-color: #fff">
      <h1>Venenatis Pharetra</h1>
      <h2>Mattis Fringilla Quam</h2>
    </header>
  </article>
  <article style="--background: url(https://images.unsplash.com/photo-1443683263937-3e377546e8a8?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=4d7ff43731c48b2b9ffdc6027accb18d);">
    <header style="--header-color: #fff">
      <h1>Venenatis Pharetra</h1>
      <h2>Mattis Fringilla Quam</h2>
    </header>
  </article>
  <article class="list">
    <p>Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
    <ul>
      <li><img src="" /> <span>Magna</span></li>
      <li><img src="" /> <span>Amet Consectetur</span></li>
      <li><img src="" /> <span>Risus</span></li>
      <li><img src="" /> <span>Quam Euismod Bibendum</span></li>
    </ul>
  </article>
</div>
              
            
!

CSS

              
                * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.grid {
  display: grid;
  width: calc(100vw - 20px);
  max-width: 1200px;
  margin: 10px;
  grid-template-rows: repeat(2, auto minmax(300px, 50vh) minmax(300px, 50vh));
  grid-template-columns: 30% 10% 30% 30%;
  font-family: Lato;
}

.grid > h1 {
  grid-column: span 4;
  line-height: 1.5;
  margin: 20px 0 0 10px;
}

.grid article {
  --background: transparent;
  margin: 10px;
  border-radius: 10px;
  box-shadow: 0 5px 10px rgba(0,0,0,.25);
  grid-column: span var(--columns);
  background: var(--background);
  background-size: cover;
  background-position: center;
  
  overflow: hidden;
  
  display: flex;
  flex-direction: column;
}

.grid article:nth-of-type(6n+1) {
  grid-column: span 2;
}
.grid article:nth-of-type(6n+2) {
  grid-column: span 1;
}
.grid article:nth-of-type(6n+3) {
  grid-column: span 1;
}
.grid article:nth-of-type(6n+4) {
  grid-column: span 1;
}
.grid article:nth-of-type(6n+5) {
  grid-column: span 2;
}
.grid article:nth-of-type(6n+6) {
  grid-column: span 1;
}

@media (max-width: 767px) {
  .grid {
    grid-template-rows: repeat(2, auto 300px 300px 300px);
    grid-template-columns: 45% 10% 45%;
  }
  
  .grid > h1 {
    grid-column: span 3;
  }
  
  .grid article:nth-of-type(6n+1) {
    grid-column: span 2;
  }
  .grid article:nth-of-type(6n+2) {
    grid-column: span 1;
  }
  .grid article:nth-of-type(6n+3) {
    grid-column: span 1;
  }
  .grid article:nth-of-type(6n+4) {
    grid-column: span 2;
  }
  .grid article:nth-of-type(6n+5) {
    grid-column: span 2;
  }
  .grid article:nth-of-type(6n+6) {
    grid-column: span 1;
  }
}

@media (max-width: 540px) {
  .grid {
    grid-template-rows: repeat(2, auto 300px 300px 300px 300px 300px 300px);
    grid-template-columns: 100%;
  }
  
  .grid > h1 {
    grid-column: span 1;
  }
  
  .grid article:nth-of-type(6n+1) {
    grid-column: span 1;
  }
  .grid article:nth-of-type(6n+2) {
    grid-column: span 1;
  }
  .grid article:nth-of-type(6n+3) {
    grid-column: span 1;
  }
  .grid article:nth-of-type(6n+4) {
    grid-column: span 1;
  }
  .grid article:nth-of-type(6n+5) {
    grid-column: span 1;
  }
  .grid article:nth-of-type(6n+6) {
    grid-column: span 1;
  }
}

.grid article header {
  --header-bg: transparent;
  --header-color: #000;
  margin-top: auto;
  padding: 10px;
  background: var(--header-bg);
  color: var(--header-color);
}
.grid article header h1,
.grid article header h2 {
  margin: 0;
  line-height: 1.5;
  white-space: nowrap;
  overflow-x: hidden;
  text-overflow: ellipsis;
}
.grid article header h1 {
  font-size: 14px;
  text-transform: uppercase;
  opacity: 0.5;
}
.grid article header h2 {
  font-size: 20px;
}

.grid article.list {
  display: flex;
  padding: 10px;
  flex-direction: column;
}
.grid article.list p,
.grid article.list ul {
  margin: 0;
  padding: 0;
}
.grid article.list p {
  margin-bottom: 10px;
}
.grid article.list ul {
  display: flex;
  flex-direction: column;
  height: 100%;
  list-style: none;
}
.grid article.list ul li {
  display: flex;
  height: 25%;
  align-items: center;
}
.grid article.list ul li img {
  display: block;
  width: 30px;
  height: 30px;
  flex-grow: 0;
  flex-shrink: 0;
  margin-right: 10px;
  border-radius: 4px;
  background: rgba(0,0,0,0.25);
}
              
            
!

JS

              
                
              
            
!
999px

Console