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

              
                <main>
  <header>
    <h1>Retro Mini Gallery</h1>
    <p>A tribute to a time in web design (not so very long ago) that was ruled by gradients, patterns, and textures.</p>
  </header>
  <ul class="gallery" role="list">
    <li class="gallery-card">
      <img src="https://images.unsplash.com/photo-1554692901-e16f2046918a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MXwxNDU4OXwwfDF8cmFuZG9tfHx8fHx8fHw&ixlib=rb-1.2.1&q=80&w=400" alt="">
      <div class="gallery-card__content">
        <h3>Fluffy Butt</h3>
        <div class="gallery-card__actions">
          <button role="button" class="gallery-card__btn-love" aria-labelledby="lovecount1">&hearts;</button>
          <span id="lovecount1" class="gallery-card__love-count">587 Loves</span>
          <button role="button" class="gallery-card__btn-share">Share</button>
        </div>
      </div>
    </li>
    <li class="gallery-card">
      <img src="https://images.unsplash.com/photo-1549950844-e6a5d47f8324?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MXwxNDU4OXwwfDF8cmFuZG9tfHx8fHx8fHw&ixlib=rb-1.2.1&q=80&w=400" alt="">
      <div class="gallery-card__content">
        <h3>Sir Winston</h3>
        <div class="gallery-card__actions">
          <button role="button" class="gallery-card__btn-love" aria-labelledby="lovecount2">&hearts;</button>
          <span id="lovecount2" class="gallery-card__love-count">62 Loves</span>
          <button role="button" class="gallery-card__btn-share">Share</button>
        </div>
      </div>
    </li>
    <li class="gallery-card">
      <img src="https://images.unsplash.com/photo-1501762248-ab9b555f5d94?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MXwxNDU4OXwwfDF8cmFuZG9tfHx8fHx8fHw&ixlib=rb-1.2.1&q=80&w=400" alt="">
      <div class="gallery-card__content">
        <h3>Chester</h3>
        <div class="gallery-card__actions">
          <button role="button" class="gallery-card__btn-love" aria-labelledby="lovecount3">&hearts;</button>
          <span id="lovecount3" class="gallery-card__love-count">34 Loves</span>
          <button role="button" class="gallery-card__btn-share">Share</button>
        </div>
      </div>
    </li>
    <li class="gallery-card">
      <img src="https://images.unsplash.com/photo-1557973964-ee879969b96d?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MXwxNDU4OXwwfDF8cmFuZG9tfHx8fHx8fHw&ixlib=rb-1.2.1&q=80&w=400" alt="">
      <div class="gallery-card__content">
        <h3>Edgar</h3>
        <div class="gallery-card__actions">
          <button role="button" class="gallery-card__btn-love" aria-labelledby="lovecount4">&hearts;</button>
          <span id="lovecount4" class="gallery-card__love-count">399 Loves</span>
          <button role="button" class="gallery-card__btn-share">Share</button>
        </div>
      </div>
    </li>
    <li class="gallery-card">
      <img src="https://images.unsplash.com/photo-1575862190741-57157577897c?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MXwxNDU4OXwwfDF8cmFuZG9tfHx8fHx8fHw&ixlib=rb-1.2.1&q=80&w=400" alt="">
      <div class="gallery-card__content">
        <h3>Lexi</h3>
        <div class="gallery-card__actions">
          <button role="button" class="gallery-card__btn-love" aria-labelledby="lovecount5">&hearts;</button>
          <span id="lovecount5" class="gallery-card__love-count">123 Loves</span>
          <button role="button" class="gallery-card__btn-share">Share</button>
        </div>
      </div>
    </li>
    <li class="gallery-card">
      <img src="https://images.unsplash.com/photo-1508547003855-6502567e0cc3?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MXwxNDU4OXwwfDF8cmFuZG9tfHx8fHx8fHw&ixlib=rb-1.2.1&q=80&w=400" alt="">
      <div class="gallery-card__content">
        <h3>Princess</h3>
        <div class="gallery-card__actions">
          <button role="button" class="gallery-card__btn-love" aria-labelledby="lovecount6">&hearts;</button>
          <span id="lovecount6" class="gallery-card__love-count">7984 Loves</span>
          <button role="button" class="gallery-card__btn-share">Share</button>
        </div>
      </div>
    </li>
  </ul>
</main>
              
            
!

CSS

              
                // Described here: https://dev.to/5t3ph/retro-mini-gallery-with-modern-css-3ba2

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: "Baloo 2", sans-serif;
}

body,
.gallery-card__actions::after {
  background: url("https://images.unsplash.com/photo-1568925855218-883a5ad2b495?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxNDU4OXwwfDF8cmFuZG9tfHx8fHx8fHx8MTYyNTYyNjczMQ&ixlib=rb-1.2.1&q=80&w=400")
    top left repeat fixed;
}

body {
  box-shadow: inset 100vw 100vh rgba(wheat, 0.5);
}

main {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

$header-text-color: rgba(scale-color(#efc88d, $lightness: -80%), 0.75);
header {
  max-width: 80ch;
  text-align: center;
  padding-left: 1rem;
  padding-right: 1rem;
  color: $header-text-color;

  p {
    font-size: 1.5rem;
    font-weight: bold;
  }
}

h1 {
  font-size: 4rem;
  margin: 0;
  text-shadow: 2px 1px 0px rgba(255, 255, 255, 0.75);
}

.gallery {
  width: 100%;
  list-style: none;
  margin: 0;
  padding: 2rem;
  display: grid;
  grid-gap: 2rem;
  justify-content: center;
  grid-template-columns: repeat(auto-fill, minmax(20ch, 1fr));
}

.gallery-card {
  background: #fff;
  box-shadow: 0.1rem 0.2rem 0.25rem rgba(black, 0.2);

  img {
    margin: 0 auto;
    padding: 0.5rem;
    display: block;
    object-fit: cover;
    width: 100%;
    max-height: 10rem;
  }
}

.gallery-card__content {
  background-image: url('data:image/svg+xml,%3Csvg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M0 0h16v2h-6v6h6v8H8v-6H2v6H0V0zm4 4h2v2H4V4zm8 8h2v2h-2v-2zm-8 0h2v2H4v-2zm8-8h2v2h-2V4z" fill="%23eee" fill-opacity="0.4" fill-rule="evenodd"/%3E%3C/svg%3E');
  padding: 0.5rem 0.5rem 0.5rem 2rem;
  border-top: 1px dashed #ccc;

  h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: bold;
  }
}

.gallery-card__actions {
  position: relative;
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;

  &::after {
    content: "";
    position: absolute;
    left: -3rem;
    top: -2.05rem;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    box-shadow: inset -0.15rem 0 0.2rem rgba(black, 0.27);
  }
}

.gallery-card__love-count {
  display: block;
  background: rgba(black, 0.05);
  padding: 0 0.35em;
  border-radius: 4px 0 0 4px;
  border: 1px solid #ccc;
  font-size: 0.875rem;
  margin-right: -0.5rem;
}

button {
  padding: 0;
  border: 0;
  cursor: pointer;
  transition: 180ms;
}

.gallery-card__btn-love {
  position: absolute;
  left: -2.75rem;
  top: -1.75rem;
  width: 1.8rem;
  height: 1.8rem;
  font-size: 1.25rem;
  border-radius: 50%;
  text-align: center;
  line-height: 2.15rem;
  z-index: 1;
  color: scale-color(#fc46e1, $lightness: -55%);
  background-image: linear-gradient(to top, #ffbdf5 0%, #ff82ec 25%, #fc46e1);

  &:hover {
    color: scale-color(#fc46e1, $lightness: -65%, $saturation: 30%);
  }

  &:focus {
    outline: none;
    box-shadow: 0 0 0 2px currentcolor;
  }
}

.gallery-card__btn-share {
  color: #fff;
  font-size: 0.875rem;
  background-image: linear-gradient(to top, #42aaff 0%, #1d65ad);
  padding: 0.25em 0.5em;
  border-radius: 1em;

  &:focus {
    outline: none;
    box-shadow: 0 0 0 2px scale-color(#1d65ad, $lightness: -25%);
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console