<div class="tile">
<strong>Hover me. No pseudo, baby!</strong>
</div>
/**
* tile screen color overlay with NO pseudo-element
*/
.tile {
--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;
align-items: flex-end;
aspect-ratio: 400 / 240;
background-blend-mode: overlay;
background-color: var(--overlay);
/* photo: https://unsplash.com/photos/Gk7enstVtGE */
background-image: url(https://marcel.imarc.host/900x540.jpg);
display: flex;
padding: 1rem;
transition: background-color var(--duration) var(--easing);
}
.tile:hover {
background-color: var(--overlay-hover);
transition: background-color var(--duration) var(--easing);
}
/**
* demo styles
*/
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background-color: ghostwhite;
font-family: system-ui, system, sans-serif;
line-height: 1.5;
max-width: 500px;
padding: 1rem;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.