JSFiddle - React, Tailwind, and code Playground

by Tan

HTML

<div class="page">
  <div class="page__demo">
    <div class="page__container">
    
    
    
    <div class="photobox photobox_type17">
        <div class="photobox__previewbox">
          <img src="https://stas-melnikov.ru/cliparts/nature640x426.jpg" class="photobox__preview" alt="Preview" width="300px" height="180px">
          <span class="photobox__label">Effect #17</span>
        </div>
      </div>
      
      
      
        </div>  </div>  </div>

CSS

.photobox{
  display: inline-block;
}

.photobox__previewbox{
  position: relative;
  overflow: hidden;
}

.photobox__preview{
  display: block;
  max-width: 100%;
}

.photobox__previewbox:before{
  content: "";
}


/* type 17 */

.photobox_type17 .photobox__previewbox:before{
  width: 100%;
  height: 100%;
  
  background-color: var(--photoboxOverlay, rgba(0, 0, 0, .8));
  opacity: 0;
  transition: opacity var(--photoboxAnimationDuration, .4s) cubic-bezier(0.71, 0.05, 0.29, 0.9);
  will-change: opacity;
  
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
}

.photobox_type17:hover .photobox__previewbox:before{
  opacity: 0.6;
}

.photobox_type17 .photobox__label{
  width: 95%;
  text-align: center;
  
  opacity: 0;  
  transition: opacity calc(var(--photoboxAnimationDuration, .4s) / 4) cubic-bezier(0.71, 0.05, 0.29, 0.9), transform calc(var(--photoboxAnimationDuration, .4s) / 4) cubic-bezier(0.71, 0.05, 0.29, 0.9);
  will-change: opacity, transform;
  
  position: absolute;
  bottom: 0px;
  left: 50%;
  transform: translate(-50%, 200%);
  z-index: 2;
}

.photobox_type17:hover .photobox__label{
  opacity: 1;
  transform: translate(-50%, -50%);
  transition-duration: calc(var(--photoboxAnimationDuration, .4s) / 2);
  transition-delay: calc(var(--photoboxAnimationDuration, .4s) / 2);
}

.photobox_type17 .photobox__preview{
	transition: transform var(--photoboxAnimationDuration, .4s) cubic-bezier(0.71, 0.05, 0.29, 0.9);
  will-change: opacity, transform;
	transform: scale(1) translate(0, 0);
}

.photobox_type17:hover .photobox__preview{
  transform: scale(1.2) translate(4%, 4%);
}