JSFiddle - React, Tailwind, and code Playground

by Darren Galway

HTML

<div class="video-grid">
  <div class="video-grid__video">
    <div class="video-grid__thumbnail"><img src="https://picsum.photos/200/300/?random" alt="" class="video-grid__img"></div>
    <div class="video-grid__content">
      <span class="video-grid__name">How many PUBG Cast Iron skillets does it take to stop a bullet?</span>
      <a href="" class="video-grid__author">Darren Galway</a>
      <span class="video-grid__views">13M views</span>
      <span class="video-grid__age">3 weeks ago</span>
    </div>
  </div>
  <div class="video-grid__video">
    <div class="video-grid__thumbnail"><img src="https://picsum.photos/200/300/?random" alt="" class="video-grid__img"></div>
    <div class="video-grid__content">
      <span class="video-grid__name">How many PUBG Cast Iron skillets does it take to stop a bullet?</span>
      <a href="" class="video-grid__author">Darren Galway</a>
      <span class="video-grid__views">13M views</span>
      <span class="video-grid__age">3 weeks ago</span>
    </div>
  </div>
  <div class="video-grid__video">
    <div class="video-grid__thumbnail"><img src="https://picsum.photos/200/300/?random" alt="" class="video-grid__img"></div>
    <div class="video-grid__content">
      <span class="video-grid__name">How many PUBG Cast Iron skillets does it take to stop a bullet?</span>
      <a href="" class="video-grid__author">Darren Galway</a>
      <span class="video-grid__views">13M views</span>
      <span class="video-grid__age">3 weeks ago</span>
    </div>
  </div>
  <div class="video-grid__video">
    <div class="video-grid__thumbnail"><img src="https://picsum.photos/200/300/?random" alt="" class="video-grid__img"></div>
    <div class="video-grid__content">
      <span class="video-grid__name">How many PUBG Cast Iron skillets does it take to stop a bullet?</span>
      <a href="" class="video-grid__author">Darren Galway</a>
      <span class="video-grid__views">13M views</span>
      <span class="video-grid__age">3 weeks ago</span>
...

SCSS

body {
  font-family: sans-serif;  
  color: #11111199;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  max-width: 900px;
  margin: 1rem auto 0;
  grid-gap: 10px;
  
  &__thumbnail {
    height: 100px;
    background: #000;
    overflow: hidden;
    
    &:hover {
      cursor: pointer;
      
      > .video-grid__img {
        transform: scale(1.1);
      }
    }
  }

  &__img {
    width: 100%;
    height: 100%;
    transition: transform 300ms ease;
    object-fit: cover;
  }
  
  &__content {
    font-size: 13px;
    padding-bottom: 14px;
  }
  
  &__name {
    display: block;
    font-size: 14px;
    font-weight: bold;
    color: #111111;
    margin: 8px 0;
  }
  
  &__author {
    display: block;
    color: inherit;
    text-decoration: none;
    line-height: 1.6;
    
    &:hover {
      color: #111111;
    }
  }
}

JavaScript

const name = document.querySelectorAll('.video-grid__name')
name.forEach(name => {
	const shorten = `${name.textContent.split('').splice(0, 55).join('')}...`;
  name.textContent = shorten
})