<div class="tle">
    <div class="tle__inner">
        <strong>This uses a pseudo-element…sad!</strong>
    </div>
</div>
  
/**
 * tile screen color overlay with pseudo-element
 */


.tle {
    --duration: 300ms;
    --easing: cubic-bezier(0.165, 0.840, 0.440, 1);
    --overlay: rgb(250 255 0 / 0.675);
    --overlay-hover: rgb(0 191 255 / 0.675);
    --duration: 150ms;
    
    /* photo: https://unsplash.com/photos/Gk7enstVtGE */
    background-image: url(https://marcel.imarc.host/900x540.jpg);
    background-repeat: no-repeat;
    padding-top: 60%;
    position: relative;
    transition: background-color var(--duration) var(--easing);
}

.tle::before {
    background-color: var(--overlay);
    content: '';
    height: 100%;
    left: 0;
    position: absolute;
    top: 0;
    transition: background-color var(--duration) var(--easing);
    width: 100%;
}

.tle__inner {
    align-items: flex-end;
    display: flex;
    height: 100%;
    left: 0;
    padding: 1rem;
    position: absolute;
    top: 0;
    width: 100%;
}

.tle:hover::before {
    background-color: var(--overlay-hover);
}



/**
 * demo styles
 */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: ghostwhite;
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    max-width: 500px;
    padding: 1rem;
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.