DEV Community

Play Button Pause Button
Prince
Prince

Posted on

Interactive cards hover using the html css and javascript. Follow us on the instagram for more....

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=
    , initial-scale=1.0">
    <title>Interactive Hover Cards</title>

    <style>

        body{
            margin: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100vh;
            font-family: Arial, Helvetica, sans-serif;
            overflow: hidden;
            color: #fff;
            background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 50%, #fbc2eb 100%);
            font-family: 'Arial', sans-serif;

        }

        .cards{
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 20px;
        }


        .cards .card{
            display: flex;
            align-items: center;justify-content: center;
            flex-direction: column;
            height: 200px;
            width: 280px;
            color: white;
            cursor: pointer;
            border-radius: 12px;
            transition: transform 400ms, box-shadow 400ms;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);




        }

        .cards .card:hover {
            transform: scale(1.1);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
        }

        .cards:hover > .card:not(:hover) {
            filter: blur(5px);
            transform: scale(0.9);
        }

        .cards .red {
            background: linear-gradient(45deg, #ff5858, #f09819);

        }

        .cards .blue {
            background: linear-gradient(45deg, #36d1dc, #5b86e5);
        }

        .cards .green {
            background: linear-gradient(45deg, #11998e, #38ef7d);
        }

        .cards .card p.title {
            font-size: 1.2em;
            font-weight: bold;
            margin: 0;
        }

        .cards .card p.subtitle {
            font-size: 0.9em;
            margin: 0;
        }


        .cards .card:hover p.title {
            text-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
        }






    </style>
</head>
<body>
    <div class="cards">
        <div class="card red">
            <p class="title">Discover Exciting colors</p>
            <p class="subtitle">Click to feel the magic!</p>
        </div>
        <div class="card blue">
            <p class="title">Feel the Cool Breeze</p>
            <p class="subtitle">Hover  to explore serenity</p>
        </div>

        <div class="card green">
            <p class="title">Embrance Nature</p>
            <p class="subtitle">Step into a world of calm.</p>
        </div>








    </div>

</body>
</html>
Enter fullscreen mode Exit fullscreen mode

Top comments (0)