Create a Grid of Responsive Product Cards Using HTML and CSS With Free Source Code By Indian Coding Wala


 <!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Product Cards</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">

    <style>
        /* Reset some default styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Style the product grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); /* Responsive grid layout */
    gap: 20px;
    margin: 15px;
}

/* Style the product card container */
.product-card {
    display: flex;
    flex-direction: column;
    border: 1px solid #e1e1e1;
    background-color: bisque;
    border-radius: 8px;
    transition: transform 0.2s ease-in-out;
    text-align: center;
}

.product-card:hover{
    background-color: #038288;
    color: white;
}

/* Style the product image */
.product-image img {
    max-width: 90%;
    height: auto;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

/* Style the product title */
.product-title {
    font-size: 1.5rem;
    margin: 10px 0;
}

/* Style the product description */




/* Style the product price */
.product-price {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 10px 0;
}

/* Style the add to cart button */
.btn-add-to-cart {
    background-color: #007BFF;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

.btn-add-to-cart:hover {
    background-color: #418d02;
}

    </style>
</head>
<body>
    <div class="product-grid">
        <!-- Product Card 1 -->
        <div class="product-card">
            <div class="product-image">
                <img src="https://clipart-library.com/img/1565435.png" alt="Product 1">
            </div>
            <div class="product-info">
                <h2 class="product-title">Apple</h2>
                <p class="product-description"><i class="fas fa-star"></i><i class="fas fa-star"></i><i class="fas fa-star"></i><i class="fas fa-star"></i><i class="fas fa-star"></i></p>
                <div class="product-price">$19.99</div>
                <div class="product-action">
                    <button class="btn-add-to-cart">Add to Cart</button>
                </div>
            </div>
            <!-- ... (Repeat structure for each product card) ... -->
        </div>

        <!-- Product Card 2 -->
        <div class="product-card">
            <div class="product-image">
                <img src="https://clipart-library.com/img/1565435.png" alt="Product 1">
            </div>
            <div class="product-info">
                <h2 class="product-title">Apple</h2>
                <p class="product-description"><i class="fas fa-star"></i><i class="fas fa-star"></i><i class="fas fa-star"></i><i class="fas fa-star"></i><i class="fas fa-star"></i></p>
                <div class="product-price">$19.99</div>
                <div class="product-action">
                    <button class="btn-add-to-cart">Add to Cart</button>
                </div>
            </div>
            <!-- ... (Repeat structure for each product card) ... -->
        </div>

        <!-- Product Card 3 -->
        <div class="product-card">
            <div class="product-image">
                <img src="https://clipart-library.com/img/1565435.png" alt="Product 1">
            </div>
            <div class="product-info">
                <h2 class="product-title">Apple</h2>
                <p class="product-description"><i class="fas fa-star"></i><i class="fas fa-star"></i><i class="fas fa-star"></i><i class="fas fa-star"></i><i class="fas fa-star"></i></p>
                <div class="product-price">$19.99</div>
                <div class="product-action">
                    <button class="btn-add-to-cart">Add to Cart</button>
                </div>
            </div>
            <!-- ... (Repeat structure for each product card) ... -->
        </div>

        <!-- Add more product cards as needed -->
       

    </div>
</body>
</html>