Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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="grid">

    <div class="box a"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_1.jpg" alt="Three hot air balloons">
      
      <div class="caption">Bristol Balloon Fiesta balloons</div>
    </div>

   

    <div class="box b"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_3.jpg" alt="A hot air balloon">
      <div class="caption">Hot air balloon</div>
    </div>
    
     <div class="box c"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_2.jpg" alt="G-PURP hot air balloon">
      <div class="caption">The G-PURP Balloon at Bristol Balloon Fiesta</div>
    </div>

    <div class="box d"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_4.jpg" alt="Several hot air balloons including a Tiptree advertising balloon">
      <div class="caption">Tiptree G-TIPJ at Bristol</div>
    </div>

    <div class="box e"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_5.jpg" alt="Several hot air balloons">
      <div class="caption">Balloons in Albuquerque</div>
    </div>

    <div class="box f"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_6.jpg" alt="Hot air balloons seen from the air">
      <div class="caption">Balloons photographed as we took off from Balloon Fiesta Field</div>
    </div>

    <div class="box g"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_7.jpg" alt="Flying in a hot air balloon">
      <div class="caption">Over Albuquerque</div>
    </div>

    <div class="box h"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_8.jpg" alt="Packing a hot air balloon that has landed">
      <div class="caption">Packing a balloon</div>
    </div>

    <div class="box i"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_9.jpg" alt="Dog shaped balloon">
      <div class="caption">A dog special shape</div>
    </div>

    <div class="box j"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_10.jpg" alt="A colourful balloon">
      <div class="caption">Landing</div>
    </div>

    <div class="box k"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_11.jpg" alt="Rainbow Ryders balloon">
      <div class="caption">Rainbow Ryders</div>
    </div>

    <div class="box l"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_12.jpg" alt="A landed balloon with some flying over">
      <div class="caption">A landed balloon</div>
    </div>

    <div class="box m"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_13.jpg" alt="Balloons in New Mexico">
      <div class="caption">Balloons in New Mexico</div>
    </div>
  </div>

</article>
              
            
!

CSS

              
                *,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 2em;
  font: 1.2em/1.5 Roboto, sans-serif;
}

img {
  max-width: 100%;
}

.box {
  display: grid;
  grid-row: auto / span 2;
  grid-template-rows: subgrid;
  margin: 10px;
}

.box img {
  height: 100%;
  width: 100%;
  object-fit: cover;
  grid-row: 1 / -1;
  grid-column: 1;
}

.box .caption {
  grid-row: -1;
  grid-column: 1;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 5px;
  color: #fff;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(4, 200px min-content);
}


@media (min-width: 800px) {
  .grid {
    max-width: 1200px;
    margin: 0 auto;
    grid-template-columns: repeat(auto-fill, minmax(300px,1fr));
    grid-auto-flow: dense;
  }


  .a {
    grid-column: span 2;
    grid-row: span 4;
  }

  .g {
    grid-column: span 2;
    grid-row: span 4;
  }
 

  
}

              
            
!

JS

              
                
              
            
!
999px

Console