πŸ”₯ Responsive Card Grid Using Flexbox | Modern UI Design with Hover Effect

Demo :


Click Video πŸ‘‡πŸ‘‡πŸ‘‡













🎯 Features:

Fully responsive on all devices πŸ“±πŸ’»
Smooth hover effect for a modern look πŸ”₯
Perfect for portfolios, blogs, and product showcases


Code :


πŸ“‚ Folder Structure:

/responsive-card-grid  

│── index.html  

│── style.css  


HTML:


<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Responsive Card Grid with Flexbox</title>

    <link rel="stylesheet" href="style.css">

</head>

<body>

    <div class="card-container">

        <div class="card">

            <img src="https://via.placeholder.com/300" alt="Card Image">

            <h2>Card Title 1</h2>

            <p>This is a description of the card content.</p>

        </div>

        <div class="card">

            <img src="https://via.placeholder.com/300" alt="Card Image">

            <h2>Card Title 2</h2>

            <p>This is a description of the card content.</p>

        </div>

        <div class="card">

            <img src="https://via.placeholder.com/300" alt="Card Image">

            <h2>Card Title 3</h2>

            <p>This is a description of the card content.</p>

        </div>

        <div class="card">

            <img src="https://via.placeholder.com/300" alt="Card Image">

            <h2>Card Title 4</h2>

            <p>This is a description of the card content.</p>

        </div>

    </div>

</body>

</html>


CSS (style.css):


* {

    margin: 0;

    padding: 0;

    box-sizing: border-box;

}


body {

    font-family: Arial, sans-serif;

    display: flex;

    justify-content: center;

    align-items: center;

    height: 100vh;

    background-color: #f7f7f7;

}


.card-container {

    display: flex;

    flex-wrap: wrap;

    justify-content: center;

    gap: 20px;

    max-width: 1200px;

    padding: 20px;

}


.card {

    background-color: white;

    border-radius: 8px;

    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);

    width: calc(25% - 20px);

    text-align: center;

    padding: 20px;

    transition: transform 0.3s ease;

}


.card img {

    width: 100%;

    border-radius: 8px;

    object-fit: cover;

}


.card h2 {

    margin-top: 15px;

    font-size: 1.2em;

    color: #333;

}


.card p {

    font-size: 0.9em;

    color: #777;

}


.card:hover {

    transform: translateY(-10px);

}


@media screen and (max-width: 1024px) {

    .card {

        width: calc(33.33% - 20px);

    }

}


@media screen and (max-width: 768px) {

    .card {

        width: calc(50% - 20px);

    }

}


@media screen and (max-width: 480px) {

    .card {

        width: 100%;

    }

Comments

Popular posts from this blog

Is This News Real or Fake? πŸ€– AI Exposes the Truth | FuzzuTech Python App Demo

🚨 Python Intrusion Detection System (IDS) – Real-Time ML + Tkinter GUI Project | FuzzuTech

πŸš€ Simple Login & Registration System in Python Tkinter πŸ“±