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

              
                <section>
  <ul>
    <li class="image_wrapper">
      <img src="https://source.unsplash.com/VWcPlbHglYc" alt="" />
      <div class="overlay overlay_0">
        <h3>10% OFF</h3> 
      </div>
    </li>
    <li class="image_wrapper">
      <img src="https://source.unsplash.com/VWcPlbHglYc" alt="" />
      <div class="overlay overlay_1">
        <h3>Image title</h3> 
      </div>
    </li>
    <li class="image_wrapper">
      <img src="https://source.unsplash.com/VWcPlbHglYc" alt="" />
      <div class="overlay overlay_2">
        <h3>Image title</h3> 
      </div>
    </li>
    <li class="image_wrapper">
      <img src="https://source.unsplash.com/VWcPlbHglYc" alt="" />
      <div class="overlay overlay_3">
        <h3>Image title</h3> 
      </div>
    </li>
    <li class="image_wrapper">
      <img src="https://source.unsplash.com/VWcPlbHglYc" alt="" />
      <div class="overlay overlay_4">
        <h3>Image title</h3> 
      </div>
    </li>
    <li class="image_wrapper">
      <img src="https://source.unsplash.com/VWcPlbHglYc" alt="" />
      <div class="overlay overlay_5">
        <a href="#" class="icon">
          <i class="fa-solid fa-camera"></i>
        </a>
      </div>
    </li>
  </ul>
</section>
              
            
!

CSS

              
                @import url(https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css);

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui;
}

section {
  margin: 0 auto;
  max-width: 1300px;
  padding: 0 10px;
}

ul {
  display: grid;
  list-style: none;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  font-weight: bolder;
  padding: 0;
}

.image_wrapper {
  position: relative;
}

img {
  display: block;
  object-fit: cover;
  width: 100%;
  height: auto;
}

.overlay {
  position: absolute; 
  background: rgba(57, 57, 57, 0.5);
  
  /* center overlay text */
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay_0 {
  left: 0;
  top: 0;
  padding: .5rem;
  margin: 4px;
  background: #f4208f;
}

.overlay_1 {
  left: 0;
  bottom: 0;
  width: 100%;
  padding: 1rem;
}

.overlay_2 {
/*   top: 0;
  right: 0;
  left: 0;
  bottom: 0; */
  inset: 0;
}

.overlay_3 {
  left: 0;
  bottom: 0;
  width: 100%;
  padding: 1rem;
  transform: scale(0);
  transition: all .3s ease-in-out;
  backdrop-filter: blur(8px) brightness(80%);
}

.image_wrapper:hover .overlay_3 {
  transform: scale(1);
}

.overlay_4 {
  left: 0;
  bottom: 100%;
  height: 0;
  width: 100%;
  overflow: hidden;
  backdrop-filter: blur(8px) brightness(80%);
  transition: all .3s ease-in-out;
}

.image_wrapper:hover .overlay_4 {
  bottom: 0;
  height: 100%;
}

.overlay_5 {
  inset: 0;
  transform: scale(0);
  transition: all .3s ease-in-out;
}

.image_wrapper:hover .overlay_5 {
  transform: scale(1);
}

.icon i {
  border-radius: 50%;
  font-size: 40px;
  color: #8c9e54;
  width: 70px;
  height: 70px;
  background: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
}

.overlay h3 {
  color: #fff;
  font-size: 2rem;
  font-weight: 500;
  margin: 0;
}

              
            
!

JS

              
                
              
            
!
999px

Console