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

              
                <div class="wrapper">
  <figure>
    <img src="http://placekitten.com/1000/1000?image=1" alt="cute kitten">
    <figcaption>
      <h2>Kitten 1</h2>
      <p>Lorem ipsum dolor sit amet.</p>
    </figcaption>
  </figure>
  <figure>
    <img src="http://placekitten.com/1000/1000?image=2" alt="cute kitten">

    <figcaption>
      <h2>Kitten 2</h2>
      <p>Lorem ipsum dolor sit amet.</p>
    </figcaption>
  </figure>
  <figure>
    <img src="http://placekitten.com/1000/1000?image=3" alt="cute kitten">
    <figcaption>
      <h2>Kitten 3</h2>
      <p>Lorem ipsum dolor sit amet.</p>
    </figcaption>
  </figure>
  <figure class="middle">
    <img src="http://placekitten.com/1000/1000?image=4" alt="cute kitten">
    <figcaption>
      <h2>Kitten 4</h2>
      <p>Lorem ipsum dolor sit amet.</p>
    </figcaption>
  </figure>
  <figure>
    <img src="http://placekitten.com/1000/1000?image=5" alt="cute kitten">
    <figcaption>
      <h2>Kitten 5</h2>
      <p>Lorem ipsum dolor sit amet.</p>
    </figcaption>
  </figure>
  <figure>
    <img src="http://placekitten.com/1000/1000?image=6" alt="cute kitten">
    <figcaption>
      <h2>Kitten 6</h2>
      <p>Lorem ipsum dolor sit amet.</p>
    </figcaption>
  </figure>
  <figure class="featured">
    <img src="http://placekitten.com/1000/1000?image=7" alt="cute kitten">
    <figcaption>
      <h2>Kitten 7</h2>
      <p>Lorem ipsum dolor sit amet.</p>
    </figcaption>
  </figure>
  <figure>
    <img src="http://placekitten.com/1000/1000?image=8" alt="cute kitten">
    <figcaption>
      <h2>Kitten 8</h2>
      <p>Lorem ipsum dolor sit amet.</p>
    </figcaption>
  </figure>
  <figure>
    <img src="http://placekitten.com/1000/1000?image=9" alt="cute kitten">
    <figcaption>
      <h2>Kitten 9</h2>
      <p>Lorem ipsum dolor sit amet.</p>
    </figcaption>
  </figure>
  <figure class="main">
    <img src="http://placekitten.com/1000/1000?image=10" alt="cute kitten">
    <figcaption>
      <h2>Kitten 10</h2>
      <p>Lorem ipsum dolor sit amet.</p>
    </figcaption>
  </figure>
  <figure>
    <img src="http://placekitten.com/1000/1000?image=11" alt="cute kitten">
    <figcaption>
      <h2>Kitten 11</h2>
      <p>Lorem ipsum dolor sit amet.</p>
    </figcaption>
  </figure>
  <figure>
    <img src="http://placekitten.com/1000/1000?image=12" alt="cute kitten">
    <figcaption>
      <h2>Kitten 12</h2>
      <p>Lorem ipsum dolor sit amet.</p>
    </figcaption>
  </figure>
</div>
              
            
!

CSS

              
                img {
  width: 100%;
  object-fit: cover;
}
figcaption {
  margin-top: -4px;
}
.wrapper {
  display: grid;
  grid-template-columns: repeat(4, minmax(min-content, 1fr));
  grid-template-areas:
    "featured featured featured featured"
   " ... ... main main";
  gap: 1%;
}
.featured {
  /* grid-row: 1/ span 2;
  grid-column: 1/ span 2; */
  grid-area: featured;
}
.main {
 /* grid-column: span 2; */
  grid-area: main;
}
.middle {
  grid-row: span 2;
  grid-column: span 2;
}



/* default styling, no changes needed here */

/* set the layout to border box model */
html {
  box-sizing: border-box;
}
*,
*::before,
*::after {
  box-sizing: inherit;
}
/* set font family and background gradient */
body {
  padding: 0;
  border: 0;
  font-family: Arial, sans-serif;
  background: linear-gradient(
    353deg,
    rgba(148, 210, 189, 1) 40%,
    rgba(61, 147, 151, 1) 100%
  );
}

/* Turn off margin, set by browser */
figure {
  margin: 0;
  padding: 0;
}
/* caption styling  */
figcaption {
  background-color: #001219;
  color: white;
  padding: 1rem;
}
/* reduces the top margin on the h2, bottom on the p, and leaves a 0.5rem gap between the two */
figcaption * {
  margin: 0.5rem;
}


              
            
!

JS

              
                /* Same instructions as before -- the HTML will tell you how many boxes per row. There should be 4 columns, just as we did with Flexbox.

However, this time, you should not need to mark each row individually. Because this is Grid, you should have enough markup here to set this up without adding extra divs.

You may need to add some classes to designate how large each box should be. Consider what your default value is - those boxes don't need a class. */
              
            
!
999px

Console