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

              
                <header>
  <h1>
    Aspect Ratios and more
  </h1>
</header>
<div class="instructions">
  <p>Add CSS to the demo to:
  <ol>
    <li>Create a grid of photos.</li>
    <li>Ensure the photos all appear the same size. Object-fit and object-position may come in handy.</li>
    <li>Use scroll snap.</li>
    <li>Try adding a sticky header.</li>
  </ol>
</div>

<ul class="photos">
  <li class="photo">
    <img src="https://picsum.photos/id/15/600/700" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/18/900/900" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/21/1300/900" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/25/900/500" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/28/1200/400" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/29/1000/400" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/23/700/400" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/13/900/400" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/15/600/700" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/18/900/900" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/21/1300/900" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/25/900/500" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/28/1200/400" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/29/1000/400" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/23/700/400" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/13/900/400" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/15/600/700" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/18/900/900" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/21/1300/900" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/25/900/500" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/28/1200/400" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/29/1000/400" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/23/700/400" alt="" />
  </li>
  <li class="photo">
    <img src="https://picsum.photos/id/13/900/400" alt="" />
  </li>
</ul>
              
            
!

CSS

              
                li {
}

ul {
}

/* Styles for demo only
   -------------------- */
ul {
  background: white;
  list-style-type: none;
  margin: 0;
  padding: 0;
}

ul li {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 20vh;
  outline: 2px dotted hsl(200 10% 70%);
  outline-offset: -1px;
}

body {
  background: hsl(20 97% 92%);
  font-family: "Taviraj", serif;
  font-size: calc(1rem + 0.5vw);
  margin: 0;
  padding: 0;
}

header {
  padding-inline: 3rem;
}

.instructions {
  padding: 0 3rem 3rem;
}

h1 {
  font-size: calc(4rem + 0.5vw);
}

ol {
  margin: 0 auto;
  text-align: left;
}

              
            
!

JS

              
                // Copy and paste more images if you need them

              
            
!
999px

Console