.gallery {
display: grid;
grid-gap: 20px;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.gallery img {
width: 100%;
}
.gallery h2 {
grid-column: 1 / -1;
display: grid;
grid-template-columns: 1fr auto 1fr;
grid-gap: 20px;
align-items: center;
}
.gallery h2:before,
.gallery h2:after {
display: block;
content: '';
height: 10px;
background: linear-gradient(to var(--direction, left), var(--yellow), transparent);
}
.gallery h2:after {
--direction: right;
}
<section class="gallery">
<h2>Instant Grams</h2>
<img src="https://source.unsplash.com/random/201x201" alt="">
<img src="https://source.unsplash.com/random/202x202" alt="">
<img src="https://source.unsplash.com/random/203x203" alt="">
<img src="https://source.unsplash.com/random/204x204" alt="">
</section>
When a user hovers over an image in my gallery, I want a friendly greeting message to appear. Existing solutions I've found online have altered my component's style, which uses a Grid layout. How can I implement animated text that maintains my current design when a user hovers over an image?