JSFiddle - React, Tailwind, and code Playground

by Alexandru Gatea

HTML

<h1>
  HOVER ELEMENTS TO EXPLORE
</h1>

<div class="carousel">
  <div class="carousel-item" style="background: url('https://images5.alphacoders.com/456/456536.jpg')">
    <div class="carousel-content">
      <h3>Sunt parinte</h3>
      <p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. </p>
    </div>
  </div>
  <div class="carousel-item" style="background: url('https://images5.alphacoders.com/456/456536.jpg')">
    <div class="carousel-content">
      <h3>Sunt cadru didactic</h3>
      <p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. </p>
    </div>
  </div>
  <div class="carousel-item" style="background: url('https://images5.alphacoders.com/456/456536.jpg')">
    <div class="carousel-content">
      <h3>Junior</h3>
      <p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. </p>
    </div>
  </div>
</div>

SCSS

* {
  box-sizing: border-box;
}

.carousel {
  margin: 50px 0;
  display: flex;
  width: 100%;
  .carousel-item {
    background-size: cover !important;
    background-repeat: no-repeat !important;
    background-position: left center !important;
    transition: all 0.5s ease;
    position: relative;
    display: block;
    flex-grow: 1;
    flex-shrink: 1;
    min-height: 300px;
    border: 2px solid #fff;
    width: 10%;
    cursor: pointer;
  }
  .carousel-item:hover {
    width: 50%;
    .carousel-content {
      opacity: 1;
      h3,
      p {
        /* top: 0; */
        opacity: 1;
      }
      h3 {

      }
      p {
 
      }
    }
  }
  .carousel-content {
    position: absolute;
    background: rgba(0, 0, 0, 0.7);
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 30px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-direction: column;
    opacity: 1;
    transition: all 0.3s ease;
    overflow: hidden;
    transition-delay: 50ms;
    h3,
    p {
      color: #fff;
      width: 100%;
      position: relative;
      transition: all 0.3s ease;
      /* top: 100%; */
      opacity: 1;
    }
    h3 {
      font-weight: bold;
      margin-bottom: 15px;
      transition-delay: 300ms;
    }
    p {
      transition-delay: 400ms;
    }
  }
}

.carousel:hover .carousel-item {
  width: calc(40% / 3);
}


.carousel .carousel-item:hover {
  width: 60%;
}