<div class="pricing-section">
<div class="billing-toggle">
<span class="label">Monthly</span>
<label class="switch">
<input type="checkbox" id="billing-switch">
<span class="slider"></span>
</label>
<span class="label">Annually <span class="badge">Save 20%</span></span>
</div>
<div class="cards-grid">
<div class="pricing-card">
<h3>Starter</h3>
<div class="price">
<span class="currency">$</span>
<span class="amount" data-monthly="15" data-annual="12">15</span>
</div>
<div class="period">/mo</div>
<ul class="features">
<li>10 Projects</li>
<li>Basic Analytics</li>
<li>Community Support</li>
</ul>
<button class="plan-btn">Choose Starter</button>
</div>
<div class="pricing-card highlighted">
<div class="ribbon">Best Value</div>
<h3>Professional</h3>
<div class="price">
<span class="currency">$</span>
<span class="amount" data-monthly="49" data-annual="39">49</span>
</div>
<div class="period">/mo</div>
<ul class="features">
<li>Unlimited Projects</li>
<li>Advanced Analytics</li>
<li>Priority Support</li>
</ul>
<button class="plan-btn primary">Choose Pro</button>
</div>
</div>
</div>*, *::before, *::after {
box-sizing: border-box;
}
body {
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
background: #f3f4f6;
margin: 0;
padding: 40px 20px;
display: flex;
justify-content: center;
}
.pricing-section {
width: 100%;
max-width: 900px;
}
.billing-toggle {
display: flex;
justify-content: center;
align-items: center;
gap: 16px;
margin-bottom: 50px;
}
.label {
font-size: 1.125rem;
font-weight: 500;
color: #374151;
display: flex;
align-items: center;
gap: 8px;
}
.badge {
background: #dcfce7;
color: #166534;
font-size: 0.75rem;
padding: 4px 8px;
border-radius: 12px;
font-weight: 600;
}
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 32px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #d1d5db;
transition: .4s;
border-radius: 32px;
}
.slider:before {
position: absolute;
content: "";
height: 24px;
width: 24px;
left: 4px;
bottom: 4px;
background-color: #ffffff;
transition: .4s;
border-radius: 50%;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
input:checked + .slider {
background-color: #3b82f6;
}
input:checked + .slider:before {
transform: translateX(28px);
}
.cards-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 30px;
}
.pricing-card {
background: #ffffff;
padding: 40px 30px;
border-radius: 16px;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
position: relative;
display: flex;
flex-direction: column;
overflow: hidden;
border: 1px solid #e5e7eb;
}
.pricing-card.highlighted {
border: 2px solid #3b82f6;
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
transform: translateY(-10px);
}
.ribbon {
position: absolute;
top: 24px;
right: -32px;
background: #3b82f6;
color: #ffffff;
padding: 6px 40px;
transform: rotate(45deg);
font-weight: 600;
font-size: 0.875rem;
}
.pricing-card h3 {
margin: 0 0 16px 0;
color: #111827;
font-size: 1.5rem;
}
.price {
display: flex;
align-items: baseline;
gap: 4px;
color: #111827;
}
.currency {
font-size: 1.5rem;
font-weight: 600;
}
.amount {
font-size: 3rem;
font-weight: 700;
letter-spacing: -1px;
}
.period {
color: #6b7280;
font-weight: 500;
margin-bottom: 24px;
font-size: 0.95rem;
min-height: 20px;
}
.features {
list-style: none;
padding: 0;
margin: 0 0 32px 0;
flex-grow: 1;
color: #4b5563;
line-height: 2.5;
}
.plan-btn {
width: 100%;
padding: 12px;
border-radius: 8px;
font-weight: 600;
cursor: pointer;
border: 1px solid #3b82f6;
background: transparent;
color: #3b82f6;
transition: all 0.2s;
font-size: 1rem;
}
.plan-btn:hover {
background: #eff6ff;
}
.plan-btn.primary {
background: #3b82f6;
color: #ffffff;
}
.plan-btn.primary:hover {
background: #2563eb;
}const toggle = document.getElementById("billing-switch");
const amounts = document.querySelectorAll(".amount");
const periods = document.querySelectorAll(".period");
toggle.addEventListener("change", (e) => {
const isAnnual = e.target.checked;
amounts.forEach(amount => {
amount.textContent = isAnnual
? amount.getAttribute("data-annual")
: amount.getAttribute("data-monthly");
});
periods.forEach(period => {
period.textContent = isAnnual ? "/mo (billed annually)" : "/mo";
});
});Nothing to show yetType HTML, CSS or JavaScript and your page appears here.
Click any element to find its code Esc
Check this code before you run it
It came from a shared link. It runs with fewer permissions, so it cannot open pop-ups, submit forms or start downloads.
0.00s / 0.00s
Nothing has animated yet. Hover, click or type in the preview and each CSS animation, transition or
element.animate() call shows up here as it plays.