This checkout form includes a promo code field, allowing users to apply discounts without leaving the checkout flow.
HTML
<form class="checkout-promo">
<h3>Checkout</h3>
<p class="subtitle">Apply a promo code to save more</p>
<!-- Customer -->
<div class="section">
<h4>Customer</h4>
<input type="text" placeholder="Full name" required>
<input type="email" placeholder="Email address" required>
</div>
<!-- Payment -->
<div class="section">
<h4>Payment</h4>
<input type="text" placeholder="Card number" required>
<div class="row">
<input type="text" placeholder="MM / YY" required>
<input type="text" placeholder="CVC" required>
</div>
</div>
<!-- Promo -->
<div class="promo">
<input type="text" placeholder="Promo code">
<button type="button" class="apply">Apply</button>
</div>
<!-- Summary -->
<div class="summary">
<div><span>Subtotal</span><span>$49.00</span></div>
<div class="discount"><span>Promo</span><span>- $5.00</span></div>
<div class="total"><span>Total</span><span>$44.00</span></div>
</div>
<button type="button" class="pay">Pay $44.00</button>
<p class="note">Secure checkout · SSL encrypted</p>
</form>Production note: Change buttons to
type="submit"and connect promo validation + payments.
CSS
:root{
--bg:#f8fafc;
--card:#ffffff;
--text:#0f172a;
--muted:#64748b;
--border:#e5e7eb;
--primary:#2563eb;
--primary-dark:#1d4ed8;
--success:#16a34a;
}
@media (prefers-color-scheme: dark){
:root{
--bg:#020617;
--card:#020617;
--text:#e5e7eb;
--muted:#94a3b8;
--border:#1f2937;
--primary:#3b82f6;
--primary-dark:#60a5fa;
--success:#22c55e;
}
}
body{
background:var(--bg);
font-family:system-ui, -apple-system, sans-serif;
}
.checkout-promo{
max-width:520px;
margin:60px auto;
padding:32px;
background:var(--card);
border-radius:20px;
border:1px solid var(--border);
box-shadow:0 20px 50px rgba(0,0,0,.12);
color:var(--text);
}
.checkout-promo h3{
font-size:24px;
margin-bottom:6px;
}
.checkout-promo .subtitle{
font-size:14px;
color:var(--muted);
margin-bottom:26px;
}
.section{ margin-bottom:24px; }
.section h4{
font-size:16px;
margin-bottom:14px;
}
.checkout-promo input{
width:100%;
padding:14px 16px;
margin-bottom:14px;
border-radius:12px;
border:1px solid var(--border);
background:linear-gradient(180deg,var(--card),var(--bg));
color:var(--text);
font-size:15px;
outline:none;
transition:border .2s ease, box-shadow .2s ease;
}
.checkout-promo input::placeholder{ color:var(--muted); }
.checkout-promo input:focus{
border-color:var(--primary);
box-shadow:0 0 0 4px rgba(37,99,235,.18);
}
.row{
display:grid;
grid-template-columns:1fr 1fr;
gap:14px;
}
.promo{
display:grid;
grid-template-columns:1fr auto;
gap:10px;
margin-bottom:18px;
}
.promo .apply{
padding:12px 16px;
border-radius:12px;
border:1px solid var(--border);
background:var(--bg);
color:var(--text);
font-weight:600;
cursor:pointer;
}
.promo .apply:hover{
border-color:var(--primary);
color:var(--primary);
}
.summary{
margin:22px 0;
padding:18px;
border-radius:14px;
border:1px solid var(--border);
background:linear-gradient(180deg,var(--bg),var(--card));
}
.summary div{
display:flex;
justify-content:space-between;
font-size:14px;
margin-bottom:8px;
}
.summary .discount{ color:var(--success); }
.summary .total{
font-weight:700;
font-size:16px;
margin-top:10px;
}
.pay{
width:100%;
padding:16px;
border:none;
border-radius:14px;
background:linear-gradient(135deg,var(--primary),var(--primary-dark));
color:#fff;
font-size:16px;
font-weight:600;
cursor:pointer;
transition:transform .15s ease, box-shadow .15s ease;
}
.pay:hover{
transform:translateY(-1px);
box-shadow:0 14px 36px rgba(0,0,0,.22);
}
.pay:active{
transform:translateY(0);
box-shadow:none;
}
.note{
margin-top:14px;
font-size:12px;
color:var(--muted);
text-align:center;
}
@media (max-width:520px){
.row{ grid-template-columns:1fr; }
}Notes
- Improves user satisfaction
- Supports marketing campaigns
- Ecommerce-friendly
Preview styles shown. Production customization recommended.
Browse More UI Components
Explore hundreds of reusable HTML & CSS UI components built for modern web projects.
Discover buttons, cards, loaders, animations, layouts, and more all with live previews and clean, copy-paste code.
