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

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

              
                <ul class="gallery">
  <li>
    <div class="aspect-ratio-square">
      <img src="https://source.unsplash.com/phvbkGThElM/800x600" alt="A neon ferris wheel" loading="lazy" />
    </div>
  </li>
  <li>
    <div class="aspect-ratio-square">
      <img src="https://source.unsplash.com/H_mTtLykvKs/800x682" alt="A dimly lit drum kit" loading="lazy" />
    </div>
  </li>
  <li>
    <div class="aspect-ratio-square">
      <img src="https://source.unsplash.com/Hc42xXu_WOg/800x567" alt="Blueberries, close up" loading="lazy" />
    </div>
  </li>
  <li>
    <div class="aspect-ratio-square">
      <img src="https://source.unsplash.com/MfynxC5_tiU/800x999" alt="High angle waterfall" loading="lazy" />
    </div>
  </li>
  <li>
    <div class="aspect-ratio-square">
      <img src="https://source.unsplash.com/7ZTx1iA7a7Q/800x397" alt="Sunset coastal scence" loading="lazy" />
    </div>
  </li>
  <li>
    <div class="aspect-ratio-square">
      <img src="https://source.unsplash.com/pRvy1j4aINE/800x785" alt="High angle shot of a recording studio" loading="lazy" />
    </div>
  </li>
  <li>
    <div class="aspect-ratio-square">
      <img src="https://source.unsplash.com/6ZDY7XhT8_0/800x800" alt="A curious Quokka" loading="lazy" />
    </div>
  </li>
  <li>
    <div class="aspect-ratio-square">
      <img src="https://source.unsplash.com/EKGBAu6QL10/800x600" alt="Swirly texture" loading="lazy" />
    </div>
  </li>
  <li>
    <div class="aspect-ratio-square">
      <img src="https://source.unsplash.com/567UmWZIYJ8/800x650" alt="Palm tree on a clear blue sky" loading="lazy" />
    </div>
  </li>
  <li>
    <div class="aspect-ratio-square">
      <img src="https://source.unsplash.com/0BZlxflMHJ8/800x732" alt="Mountains in a sunset" loading="lazy" />
    </div>
  </li>
  <li>
    <div class="aspect-ratio-square">
      <img src="https://source.unsplash.com/QHQgnu8tx-A/800x943" alt="Grand Canyon" loading="lazy" />
    </div>
  </li>
  <li>
    <div class="aspect-ratio-square">
      <img src="https://source.unsplash.com/tWOt1vRvob4/800x867" alt="Pie with a slice missing" loading="lazy" />
    </div>
  </li>
</ul>
              
            
!

CSS

              
                /**
 * ASPECT RATIO
 * A utility that provides you with a predictable aspect ratio
 *
 * ratio-wide: a 16:9 aspect
 * ratio-square: a perfect square
 */
[class*='aspect-ratio-'] {
  display: block;
  position: relative;
}

[class*='aspect-ratio-'] > * {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.aspect-ratio-wide {
  padding-top: 56.25%;
}

.aspect-ratio-square {
  padding-top: 100%;
}



/* Presentational styles */

body {
  background: #efefef;
  padding: 1rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  grid-gap: 0.4rem;
}

.gallery img {
  object-fit: cover;
}
              
            
!

JS

              
                
              
            
!
999px

Console