Transparent Fees Breakdown — Free HTML CSS JS Snippet, No Hidden Fees
Transparent Fees Breakdown · Pricing · Plain HTML, CSS & JS · Live preview
Copy & paste
Source Code
<div class="hfb-wrap">
<div class="hfb-card">
<div class="hfb-head">
<p class="hfb-plan">Team plan</p>
<h2 class="hfb-title">No hidden fees — see exactly what you pay</h2>
</div>
<button class="hfb-toggle" id="hfbToggle" aria-expanded="false" aria-controls="hfbLines">
<span>Show full price breakdown</span>
<svg class="hfb-chevron" width="16" height="16" viewBox="0 0 24 24" fill="none"><path d="M6 9l6 6 6-6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>
</button>
<div class="hfb-lines" id="hfbLines" hidden>
<div class="hfb-line" data-amount="49.00"><span>Base subscription</span><span class="hfb-amt">$49.00</span></div>
<div class="hfb-line" data-amount="2.00"><span>Platform fee</span><span class="hfb-amt">$2.00</span></div>
<div class="hfb-line" data-amount="1.48"><span>Payment processing (2.9%)</span><span class="hfb-amt">$1.48</span></div>
<div class="hfb-line" data-amount="4.46"><span>Estimated sales tax (8.5%)</span><span class="hfb-amt">$4.46</span></div>
</div>
<div class="hfb-total-row">
<span>Total charged today</span>
<span class="hfb-total" id="hfbTotal">—</span>
</div>
<p class="hfb-check" id="hfbCheck"></p>
<button class="hfb-cta">Subscribe — pay <span id="hfbCtaTotal">—</span>/mo</button>
</div>
</div>*{box-sizing:border-box;margin:0;padding:0}
body{font-family:system-ui,-apple-system,sans-serif;background:#0a0f0d;min-height:100vh;display:flex;align-items:center;justify-content:center;padding:32px}
.hfb-wrap{width:100%;max-width:400px}
.hfb-card{background:linear-gradient(165deg,#122019,#0c1512);border:1px solid #1f3a2c;border-radius:20px;padding:28px 26px}
.hfb-plan{font-size:12px;font-weight:700;color:#34d399;text-transform:uppercase;letter-spacing:.06em}
.hfb-title{font-size:18px;font-weight:800;color:#f4f7fb;margin-top:8px;line-height:1.35}
.hfb-toggle{width:100%;margin-top:20px;display:flex;justify-content:space-between;align-items:center;background:#0e1a15;border:1.5px solid #1f3a2c;color:#c3cbdb;font-family:inherit;font-size:13px;font-weight:700;padding:12px 14px;border-radius:10px;cursor:pointer}
.hfb-chevron{transition:transform .2s;color:#34d399}
.hfb-toggle[aria-expanded="true"] .hfb-chevron{transform:rotate(180deg)}
.hfb-lines{margin-top:4px;display:flex;flex-direction:column;overflow:hidden}
.hfb-line{display:flex;justify-content:space-between;font-size:13px;color:#9aa8a0;padding:11px 14px;border-bottom:1px dashed #1f3a2c}
.hfb-amt{color:#c3cbdb;font-variant-numeric:tabular-nums;font-weight:600}
.hfb-total-row{display:flex;justify-content:space-between;align-items:baseline;margin-top:16px;padding-top:16px;border-top:1.5px solid #1f3a2c}
.hfb-total-row span:first-child{font-size:13.5px;font-weight:700;color:#f4f7fb}
.hfb-total{font-size:24px;font-weight:800;color:#34d399;font-variant-numeric:tabular-nums}
.hfb-check{font-size:11.5px;color:#5c6779;margin-top:6px}
.hfb-cta{width:100%;margin-top:18px;background:#34d399;color:#062018;border:none;font-family:inherit;font-size:14.5px;font-weight:800;padding:13px;border-radius:10px;cursor:pointer;transition:background .15s}
.hfb-cta:hover{background:#2fc290}const toggle = document.getElementById('hfbToggle');
const lines = document.getElementById('hfbLines');
const totalEl = document.getElementById('hfbTotal');
const ctaTotalEl = document.getElementById('hfbCtaTotal');
const checkEl = document.getElementById('hfbCheck');
// The total is the REAL computed sum of every itemized line — never a
// separately hardcoded number that could silently drift out of sync.
const lineEls = Array.from(lines.querySelectorAll('.hfb-line'));
const total = lineEls.reduce((sum, el) => sum + parseFloat(el.dataset.amount), 0);
const totalFormatted = '$' + total.toFixed(2);
totalEl.textContent = totalFormatted;
ctaTotalEl.textContent = totalFormatted;
checkEl.textContent =
lineEls.map((el) => '$' + parseFloat(el.dataset.amount).toFixed(2)).join(' + ') +
' = ' + totalFormatted + ' — the math you see is the math you pay.';
toggle.addEventListener('click', () => {
const expanded = toggle.getAttribute('aria-expanded') === 'true';
toggle.setAttribute('aria-expanded', String(!expanded));
lines.hidden = expanded;
toggle.querySelector('span').textContent = expanded
? 'Show full price breakdown'
: 'Hide price breakdown';
});Extend with AI
Take This Snippet Further With AI
The AI prompt for this one is for Patreon supporters ($3 a month, 7 days free), along with a site with no ads. Supporters enter the passcode once and it is remembered in this browser.
What's included
Features
About this UI Snippet
Transparent Fees Breakdown — A Total That Is Actually the Sum of What You See

"No hidden fees" is a claim most pricing pages make in text without proving it. This snippet proves it structurally: the checkout total displayed is never a separately hardcoded number sitting next to the itemized fee list — it is computed at runtime by summing the exact line items rendered on screen, so the total and the line items can never silently drift apart.
One array, one reduce, one total
Every fee line is a .hfb-line element carrying its dollar amount in a data-amount attribute. The JS collects all of them and computes lineEls.reduce((sum, el) => sum + parseFloat(el.dataset.amount), 0) — a genuine sum of the base subscription (\$49.00), platform fee (\$2.00), payment processing at 2.9% (\$1.48), and estimated sales tax at 8.5% (\$4.46), landing on \$56.94. That total is written into both the summary row and the CTA button from the same computed variable, so there is structurally no way for the displayed total to disagree with what the itemized lines actually add up to.
The math is shown, not just claimed
Beneath the total, a small line of arithmetic — $49.00 + $2.00 + $1.48 + $4.46 = $56.94 — is generated from the same array the total was computed from, spelling out the addition explicitly rather than asking the visitor to trust an opaque final figure. This is the detail that turns "no hidden fees" from marketing copy into something a skeptical shopper can verify themselves in three seconds.
An accordion, not a wall of fees by default
The itemized breakdown starts collapsed behind a "Show full price breakdown" toggle so the card isn't visually noisy for visitors who just want the bottom-line number — but the total is always visible regardless of whether the accordion is open, and expanding it never changes the total, only reveals how it was derived. aria-expanded on the toggle button keeps the interaction accessible to screen readers and keyboard users, and the chevron icon rotates to reflect state.
Why this pattern matters for checkout trust
Surprise fees revealed only at the final step of checkout are one of the most common reasons for cart abandonment and post-purchase disputes. Structuring the total as a genuine sum of visible line items — rather than a number a designer typed in separately from the fee list — is a small implementation choice with an outsized trust payoff: it makes "no hidden fees" a property of the code, not just a sentence on the page.
Customizing it
Add, remove, or change fee lines by editing the data-amount attributes and their labels — the total, the CTA button text, and the arithmetic line all recompute automatically from whatever lines are present. Pair it with pricing card or a full pricing page as the transparency detail beneath the headline price.
Step by step
How to Use
- 1See the always-visible totalThe total is shown before the breakdown is even expanded.
- 2Expand the breakdownClick the toggle to reveal every itemized fee line.
- 3Check the arithmetic lineIt spells out the exact addition that produces the total.
- 4Confirm nothing changes on toggleExpanding or collapsing never alters the computed total.
- 5Add a fee lineAdd a .hfb-line element with a data-amount attribute — the total updates automatically.
- 6Change a fee amountEdit a data-amount value and the sum, CTA text, and arithmetic line all recompute.
Real-world uses
Common Use Cases
reduce() over the visible line items.aria-expanded so screen reader users know the state.Got questions?
Frequently Asked Questions
It is genuinely computed at runtime: the JS collects every .hfb-line element, reads its data-amount attribute, and sums them with Array.reduce(). The total, the CTA button text, and the arithmetic line beneath the total are all written from that single computed value, so there is no separately hardcoded total that could disagree with the itemized lines.
Yes — $49.00 base plus $2.00 platform fee plus $1.48 processing (2.9%) plus $4.46 estimated tax (8.5%) sums to exactly $56.94, and this is the literal reduce() result rather than a coincidentally matching hand-typed number.
Stating a final number alone still asks a skeptical shopper to trust that it was derived correctly. Spelling out the exact addition that produces it — generated from the same data the total was computed from — lets a visitor verify it themselves in seconds, which is a meaningfully stronger trust signal than the total alone.
No. The total is computed once from the underlying data-amount values and displayed regardless of whether the breakdown is expanded. The accordion only controls whether the itemized lines are visible; it never recalculates or alters the total itself.
Add another .hfb-line element inside #hfbLines with its own data-amount attribute and label text. Because the total is computed by summing whatever .hfb-line elements are present at runtime, no other code needs to change — the total, CTA text, and arithmetic line all pick up the new fee automatically.