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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <h1>The Complementary Image, Take 2</h1>

<ul class="grid grid--uniform grid--view-items">
  <li class="grid__item">
    <div class="grid-view-item">
      <a class="grid-view-item__link grid-view-item__image-container" href="#">
        <span class="visuallyhidden">Pocket Armchair by Rudolph Schelling Webermann</span>
      </a>
      <div id="ProductCardImageWrapper-1522681085275-556384878650" class="grid-view-item__image-wrapper">
        <div>
          <img id="ProductCardImage-1522681085275-556384878650" class="grid-view-item__image" src="//cdn.shopify.com/s/files/1/0014/4972/1914/products/3bd746af-4023-46fa-8971-adcd4399bcfa_2048x2048_207baadf-7ab6-496e-adce-5efee3fc0a1f_300x300.jpg?v=1521742695"
               alt="">
        </div>
      </div>
      <div class="grid-view-item__title" aria-hidden="true">
        Pocket Armchair by Rudolph Schelling Webermann
      </div>
      <dl class="grid-view-item__description-list">
        <div class="grid-view-item__meta">
          <dt>
            <span class="visuallyhidden">Regular price</span>
          </dt>
          <dd class="grid-view-item__description">
            <span class="product-price__price">$1,199.00</span>
          </dd>
        </div>
        <div class="grid-view-item__description">
          <dt>
            <span class="visuallyhidden">Item description</span>
          </dt>
          <dd class="grid-view-item__description">
            <span class="visuallyhidden">Chair seat is one solid piece in a scoop like fashion, black in color. Chair legs are supported by cross panelling attached to each of the four legs, birch color.</span>
          </dd>
        </div>
      </dl>
    </div>
  </li>

  <li class="grid__item">
    <div class="grid-view-item">
      <a class="grid-view-item__link grid-view-item__image-container" href="#">
        <span class="visuallyhidden">Palo 2-Seater Chaise Right by HEM Design Studio</span>
      </a>
      <div id="ProductCardImageWrapper-1522681085275-556384452666" class="grid-view-item__image-wrapper">
        <div>
          <img id="ProductCardImage-1522681085275-556384452666" class="grid-view-item__image" src="//cdn.shopify.com/s/files/1/0014/4972/1914/products/987b0e5b-97e7-4231-80df-bee75ff1dd36_2048x2048-1_300x300.jpg?v=1521742680" alt="">
        </div>
      </div>
      <div class="grid-view-item__title" aria-hidden="true">
        Palo 2-Seater Chaise Right by HEM Design Studio
      </div>
      <dl class="grid-view-item__description-list">
        <div class="grid-view-item__meta">
          <dt>
            <span class="visuallyhidden">Regular price</span>
          </dt>
          <dd class="grid-view-item__description">
            <span class="product-price__price">$1,549.00</span>
          </dd>
        </div>
        <div class="grid-view-item__description">
          <dt>
            <span class="visuallyhidden">Item description</span>
          </dt>
          <dd class="grid-view-item__description">
            <span class="visuallyhidden">Sofa is light grey in color, low profile. Two rounded back coushions sit along the back with one rounded cushion on the left side. Sofa sits flat on the floor.</span>
          </dd>
        </div>
      </dl>
    </div>
  </li>

  <li class="grid__item">
    <div class="grid-view-item">
      <a class="grid-view-item__link grid-view-item__image-container" href="#">
        <span class="visuallyhidden">Key Side Table by GamFratesi</span>
      </a>
      <div id="ProductCardImageWrapper-1522681085275-556384190522" class="grid-view-item__image-wrapper">
        <div>
          <img id="ProductCardImage-1522681085275-556384190522" class="grid-view-item__image" src="//cdn.shopify.com/s/files/1/0014/4972/1914/products/78a36c82-2696-4782-8d8f-dece3d8d93f8_2048x2048_a8358b6c-7989-4086-983b-fb2c926360ba_300x300.jpg?v=1521742656"
            alt="">
        </div>
      </div>
      <div class="grid-view-item__title" aria-hidden="true">
        Key Side Table by GamFratesi
      </div>
      <dl class="grid-view-item__description-list">
        <div class="grid-view-item__meta">
          <dt>
            <span class="visuallyhidden">Regular price</span>
          </dt>
          <dd class="grid-view-item__description">
            <span class="product-price__price">$179.00</span>
          </dd>
        </div>
        <div class="grid-view-item__description">
          <dt>
            <span class="visuallyhidden">Item description</span>
          </dt>
          <dd class="grid-view-item__description">
            <span class="visuallyhidden">Round table top, birch wood color. Table is supported by three legs, black color. Legs stem from the middle of the table outward towards the floor.</span>
          </dd>
        </div>
      </dl>
    </div>
  </li>
</ul>

<h2>Note</h2>
<p>This is a modified demo of <a href="https://codepen.io/svinkle/pen/YamvaP" target="_blank" rel="noopener" aria-describedby="new-window-0">the original demo component <svg class="icon icon--new-window" viewBox="0 0 24 24" focusable="false" aria-hidden="true"> <use xlink:href="#new-window"></use> </svg></a> to the article, <a href="https://medium.com/@svinkle/the-complimentary-image-60a495adee63" target="_blank" rel="noopener" aria-describedby="new-window-2">The Complementary Image <svg class="icon icon--new-window" viewBox="0 0 24 24" focusable="false" aria-hidden="true"> <use xlink:href="#new-window"></use> </svg></a>. Check it out for more details!</p>

<!-- What's this stuff for? See: https://medium.com/@svinkle/why-let-someone-know-when-a-link-opens-a-new-window-8699d20ed3b1 -->

<!-- New window warning messages -->
<div hidden>
  <span id="new-window-0">Opens in a new window</span>
  <span id="new-window-1">Opens an external site</span>
  <span id="new-window-2">Opens an external site in a new window</span>  
</div>

<!-- SVG sprite sheet -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" hidden>
    <symbol id="new-window" viewBox="0 0 24 24">
      <g transform="scale(0.0234375 0.0234375)"> 
        <path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z"></path>
      </g>
    </symbol>
    <symbol id="github" viewBox="0 0 48 48">
      <g transform="scale(0.046875 0.046875)">
        <path d="M512.008 12.642c-282.738 0-512.008 229.218-512.008 511.998 0 226.214 146.704 418.132 350.136 485.836 25.586 4.738 34.992-11.11 34.992-24.632 0-12.204-0.48-52.542-0.696-95.324-142.448 30.976-172.504-60.41-172.504-60.41-23.282-59.176-56.848-74.916-56.848-74.916-46.452-31.778 3.51-31.124 3.51-31.124 51.4 3.61 78.476 52.766 78.476 52.766 45.672 78.27 119.776 55.64 149.004 42.558 4.588-33.086 17.852-55.68 32.506-68.464-113.73-12.942-233.276-56.85-233.276-253.032 0-55.898 20.004-101.574 52.76-137.428-5.316-12.9-22.854-64.972 4.952-135.5 0 0 43.006-13.752 140.84 52.49 40.836-11.348 84.636-17.036 128.154-17.234 43.502 0.198 87.336 5.886 128.256 17.234 97.734-66.244 140.656-52.49 140.656-52.49 27.872 70.528 10.35 122.6 5.036 135.5 32.82 35.856 52.694 81.532 52.694 137.428 0 196.654-119.778 239.95-233.79 252.624 18.364 15.89 34.724 47.046 34.724 94.812 0 68.508-0.596 123.644-0.596 140.508 0 13.628 9.222 29.594 35.172 24.566 203.322-67.776 349.842-259.626 349.842-485.768 0-282.78-229.234-511.998-511.992-511.998z"></path>
      </g>
    </symbol>
  </svg>
              
            
!

CSS

              
                .grid {
  display: flex;
  flex-wrap: wrap;
}

.grid--view-items {
  list-style-type: none;
  margin: 0 -1rem;
  padding: 0;
}

.grid__item {
  color: Crimson;
  margin: 1rem;
  position: relative;
  width: 10rem;
}

.grid-view-item__link {
  bottom: 0;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.grid__item:focus-within,
.grid__item:hover {
  color: FireBrick;
}

.grid-view-item__image {
  width: 10rem;
  height: 10rem;
  object-fit: cover;
}

.grid-view-item__title {
  display: inline-block;
  margin-top: 1rem;
}

.grid-view-item__description {
  margin: 0;
}
              
            
!

JS

              
                
              
            
!
999px

Console