Preview:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dynamic Pricing Table</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #f4f4f4;
            margin: 0;
        }

        .pricing-table {
            display: flex;
            justify-content: space-around;
            width: 80%;
        }

        .card {
            background-color: #fff;
            border: 1px solid #ccc;
            border-radius: 10px;
            padding: 20px;
            text-align: center;
            transition: transform 0.3s, box-shadow 0.3s;
            width: 30%;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        }

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

        .card.selected {
            background-color: #007bff;
            color: white;
            border: none;
        }

        .card.selected:hover {
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
        }

        .price {
            font-size: 2rem;
            margin: 10px 0;
        }

        button {
            padding: 10px 20px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            background-color: #007bff;
            color: white;
            transition: background-color 0.3s;
        }

        button:hover {
            background-color: #0056b3;
        }
    </style>
</head>
<body>

<div class="pricing-table">
    <div class="card" onclick="selectCard(this)">
        <h3>Basic Plan</h3>
        <div class="price">$10/month</div>
        <p>Basic features included.</p>
        <button>Choose</button>
    </div>
    <div class="card" onclick="selectCard(this)">
        <h3>Standard Plan</h3>
        <div class="price">$20/month</div>
        <p>Standard features included.</p>
        <button>Choose</button>
    </div>
    <div class="card" onclick="selectCard(this)">
        <h3>Premium Plan</h3>
        <div class="price">$30/month</div>
        <p>All features included.</p>
        <button>Choose</button>
    </div>
</div>

<script>
    function selectCard(card) {
        // Remove 'selected' class from all cards
        const cards = document.querySelectorAll('.card');
        cards.forEach(c => c.classList.remove('selected'));
        // Add 'selected' class to the clicked card
        card.classList.add('selected');
    }
</script>

</body>
</html>
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter