JSFiddle - React, Tailwind, and code Playground

by Slee

HTML

<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <title>Efecto Hover a Una Imagen</title>
    <link rel="stylesheet" href="estilos.css">
</head>
<body>
    <div class="contenedor">
       <a href="#">
            <figure>
                <img src="https://cdn.pixabay.com/photo/2024/09/10/22/25/architectural-design-9038365_1280.jpg" alt="Imagen con Efecto Hover">
                <div class="capa">
                    <h3>SLee Dw</h3>
                    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Maiores, vero!</p>
                </div>
            </figure>
        </a>
    </div>
</body>
</html>

CSS

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: sans-serif;
}

.contenedor {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.contenedor figure {
    position: relative;
    width: 400px;
    height: 250px;
    cursor: pointer;
    overflow: hidden;
    border-radius: 6px;
    box-shadow: 0px 15px 25px rgba(0,0,0,0.50);
}

.contenedor figure img {
    width: 100%;
    height: 100%;
    transition: all 400ms ease-out;
    will-change: transform;
}

.contenedor figure .capa {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 103, 123, 0.7);
    transition: all 400ms ease-out;
    opacity: 0;
    visibility: hidden;
    text-align: center;
}

.contenedor figure:hover > .capa {
    opacity: 1;
    visibility: visible;
}

.contenedor figure:hover > img {
    transform: scale(1.3);
}

.contenedor figure .capa h3 {
    color: #fff;
    font-weight: 400;
    margin: 70px 0 15px;
    transition: all 400ms ease-out;
}

.contenedor figure .capa p {
    color: #fff;
    font-size: 15px;
    line-height: 1.5;
    max-width: 220px;
    margin: auto;
}