Order summary with item receipt cards in HTML, CSS and vanilla JS
A copy-paste Order summary with item receipt cards in plain HTML and CSS, with vanilla JavaScript: no framework, no build step, MIT-licensed.
Live preview
Source (copy-ready)
<section class="dcl-order-summary-receipt-cards-root" aria-label="Order summary with item receipt cards" data-dcl-scheme="light">
<h2>Review the printed guide order</h2><ul class="dcl-order-summary-receipt-cards-grid" role="list"><li><div class="dcl-order-summary-receipt-cards-panel"><h3>Pocket trail guide</h3><dl class="dcl-order-summary-receipt-cards-stack"><div class="dcl-order-summary-receipt-cards-bar dcl-order-summary-receipt-cards-spread"><dt>Quantity</dt><dd>2</dd></div><div class="dcl-order-summary-receipt-cards-bar dcl-order-summary-receipt-cards-spread"><dt>Line price</dt><dd>$20.00</dd></div></dl></div></li>
<li><div class="dcl-order-summary-receipt-cards-panel"><h3>Waterproof route sheet</h3><dl class="dcl-order-summary-receipt-cards-stack"><div class="dcl-order-summary-receipt-cards-bar dcl-order-summary-receipt-cards-spread"><dt>Quantity</dt><dd>1</dd></div><div class="dcl-order-summary-receipt-cards-bar dcl-order-summary-receipt-cards-spread"><dt>Line price</dt><dd>$6.00</dd></div></dl></div></li></ul><div class="dcl-order-summary-receipt-cards-border"><dl class="dcl-order-summary-receipt-cards-stack"><div class="dcl-order-summary-receipt-cards-bar dcl-order-summary-receipt-cards-spread"><dt>Items</dt><dd>$26.00</dd></div><div class="dcl-order-summary-receipt-cards-bar dcl-order-summary-receipt-cards-spread"><dt>Delivery</dt><dd>$4.00</dd></div><div class="dcl-order-summary-receipt-cards-bar dcl-order-summary-receipt-cards-spread"><dt>Order total</dt><dd>$30.00</dd></div></dl></div>
<script>
(() => {
const root = document.currentScript.closest(".dcl-order-summary-receipt-cards-root");
const preference = matchMedia("(prefers-color-scheme: dark)");
const apply = () => {
root.dataset.dclScheme = document.documentElement.dataset.theme || (preference.matches ? "dark" : "light");
};
preference.addEventListener("change", apply);
apply();
})();
</script>
</section>
<style>
.dcl-order-summary-receipt-cards-root { color: #11292f; background-color: #ffffff; color-scheme: light; }
.dcl-order-summary-receipt-cards-root .dcl-order-summary-receipt-cards-panel, .dcl-order-summary-receipt-cards-root .dcl-order-summary-receipt-cards-badge,
.dcl-order-summary-receipt-cards-root button, .dcl-order-summary-receipt-cards-root input, .dcl-order-summary-receipt-cards-root select, .dcl-order-summary-receipt-cards-root summary {
color: #11292f; background-color: #e4edef; border-color: #697f84;
}
.dcl-order-summary-receipt-cards-root .dcl-order-summary-receipt-cards-muted { color: #405a60; }
.dcl-order-summary-receipt-cards-root button:hover, .dcl-order-summary-receipt-cards-root button[aria-pressed="true"], .dcl-order-summary-receipt-cards-root summary:hover {
color: #ffffff; background-color: #00535a;
}
.dcl-order-summary-receipt-cards-root a { color: #005c62; }
.dcl-order-summary-receipt-cards-root :focus-visible { outline: 3px solid #005c62; outline-offset: 3px; }
.dcl-order-summary-receipt-cards-root { --edge: #697f84; --accent: #00535a; }
.dcl-order-summary-receipt-cards-root[data-dcl-scheme="dark"] { color: #eff8f9; background-color: #142f36; color-scheme: dark; }
.dcl-order-summary-receipt-cards-root[data-dcl-scheme="dark"] .dcl-order-summary-receipt-cards-panel, .dcl-order-summary-receipt-cards-root[data-dcl-scheme="dark"] .dcl-order-summary-receipt-cards-badge,
.dcl-order-summary-receipt-cards-root[data-dcl-scheme="dark"] button, .dcl-order-summary-receipt-cards-root[data-dcl-scheme="dark"] input, .dcl-order-summary-receipt-cards-root[data-dcl-scheme="dark"] select, .dcl-order-summary-receipt-cards-root[data-dcl-scheme="dark"] summary {
color: #eff8f9; background-color: #1c3c44; border-color: #839fa5;
}
.dcl-order-summary-receipt-cards-root[data-dcl-scheme="dark"] .dcl-order-summary-receipt-cards-muted { color: #b0c9ce; }
.dcl-order-summary-receipt-cards-root[data-dcl-scheme="dark"] button:hover, .dcl-order-summary-receipt-cards-root[data-dcl-scheme="dark"] button[aria-pressed="true"], .dcl-order-summary-receipt-cards-root[data-dcl-scheme="dark"] summary:hover {
color: #11292f; background-color: #8fe1da;
}
.dcl-order-summary-receipt-cards-root[data-dcl-scheme="dark"] a { color: #8fe1da; }
.dcl-order-summary-receipt-cards-root[data-dcl-scheme="dark"] :focus-visible { outline: 3px solid #8fe1da; outline-offset: 3px; }
.dcl-order-summary-receipt-cards-root[data-dcl-scheme="dark"] { --edge: #839fa5; --accent: #8fe1da; }
.dcl-order-summary-receipt-cards-root { display: grid; gap: 1rem; box-sizing: border-box; max-inline-size: 60rem; margin-inline: auto; padding: clamp(0.875rem, 3vw, 2rem);
border: 1px solid var(--edge); border-radius: 0.75rem; font: 1rem/1.55 system-ui, sans-serif; overflow-wrap: anywhere; }
.dcl-order-summary-receipt-cards-root * { box-sizing: border-box; min-inline-size: 0; }
.dcl-order-summary-receipt-cards-root h2, .dcl-order-summary-receipt-cards-root h3, .dcl-order-summary-receipt-cards-root p, .dcl-order-summary-receipt-cards-root ul, .dcl-order-summary-receipt-cards-root ol, .dcl-order-summary-receipt-cards-root dl, .dcl-order-summary-receipt-cards-root dd, .dcl-order-summary-receipt-cards-root figure, .dcl-order-summary-receipt-cards-root blockquote, .dcl-order-summary-receipt-cards-root fieldset { margin: 0; }
.dcl-order-summary-receipt-cards-root h2 { font-size: clamp(1.375rem, 3vw, 2rem); line-height: 1.18; }
.dcl-order-summary-receipt-cards-root h3 { font-size: 1.125rem; line-height: 1.3; }
.dcl-order-summary-receipt-cards-root ul, .dcl-order-summary-receipt-cards-root ol { padding: 0; list-style: none; }
.dcl-order-summary-receipt-cards-panel > * + *, .dcl-order-summary-receipt-cards-disclosure > * + * { margin-block-start: 0.65rem; }
.dcl-order-summary-receipt-cards-stack, .dcl-order-summary-receipt-cards-grid, .dcl-order-summary-receipt-cards-split, .dcl-order-summary-receipt-cards-rail { display: grid; gap: 1rem; align-items: start; }
.dcl-order-summary-receipt-cards-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.dcl-order-summary-receipt-cards-split { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.dcl-order-summary-receipt-cards-rail { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.dcl-order-summary-receipt-cards-bar { display: flex; flex-wrap: wrap; gap: 0.625rem; align-items: center; }
.dcl-order-summary-receipt-cards-spread { justify-content: space-between; }
.dcl-order-summary-receipt-cards-panel { padding: 1rem; border: 1px solid var(--edge); border-radius: 0.625rem; }
.dcl-order-summary-receipt-cards-badge { display: inline-block; width: fit-content; border: 1px solid var(--edge); border-radius: 1rem;
padding: 0.16rem 0.65rem; font-size: 0.875rem; font-weight: 650; }
.dcl-order-summary-receipt-cards-muted { font-size: 0.875rem; }
.dcl-order-summary-receipt-cards-root button, .dcl-order-summary-receipt-cards-root input, .dcl-order-summary-receipt-cards-root select, .dcl-order-summary-receipt-cards-root summary {
font: inherit; padding: 0.45rem 0.7rem; border: 1px solid; border-radius: 0.375rem; max-inline-size: 100%; }
.dcl-order-summary-receipt-cards-root input[type="checkbox"], .dcl-order-summary-receipt-cards-root input[type="radio"] { inline-size: 1.15rem; block-size: 1.15rem; accent-color: var(--accent); }
.dcl-order-summary-receipt-cards-root button, .dcl-order-summary-receipt-cards-root select, .dcl-order-summary-receipt-cards-root summary, .dcl-order-summary-receipt-cards-root label { cursor: pointer; }
.dcl-order-summary-receipt-cards-root button:disabled { cursor: not-allowed; border-style: dashed; }
.dcl-order-summary-receipt-cards-root button:active, .dcl-order-summary-receipt-cards-root summary:active { text-decoration: underline; }
.dcl-order-summary-receipt-cards-root a { display: inline-block; padding: 0.2rem; text-underline-offset: 0.2em; }
.dcl-order-summary-receipt-cards-root a:hover { text-decoration-thickness: 2px; }
.dcl-order-summary-receipt-cards-root fieldset { padding: 0.75rem; border: 1px solid var(--edge); border-radius: 0.5rem; }
.dcl-order-summary-receipt-cards-root legend { font-weight: 700; padding-inline: 0.35rem; }
.dcl-order-summary-receipt-cards-scroll { overflow-x: auto; padding: 0.2rem; }
.dcl-order-summary-receipt-cards-root table { border-collapse: collapse; inline-size: 100%; text-align: start; }
.dcl-order-summary-receipt-cards-root caption { text-align: start; font-weight: 700; padding-block: 0.375rem; }
.dcl-order-summary-receipt-cards-root td, .dcl-order-summary-receipt-cards-root th { border-block-end: 1px solid var(--edge); padding: 0.5rem; text-align: start; }
.dcl-order-summary-receipt-cards-root svg { display: block; max-inline-size: 100%; block-size: auto; }
.dcl-order-summary-receipt-cards-border { border-inline-start: 0.25rem solid var(--accent); padding-inline-start: 0.875rem; }
.dcl-order-summary-receipt-cards-center { text-align: center; justify-items: center; }
.dcl-order-summary-receipt-cards-center svg { margin-inline: auto; }
.dcl-order-summary-receipt-cards-root [hidden] { display: none; }
.dcl-order-summary-receipt-cards-stack[hidden], .dcl-order-summary-receipt-cards-bar[hidden] { display: none; }
@media (max-width: 34rem) { .dcl-order-summary-receipt-cards-rail { grid-template-columns: minmax(0, 1fr); } }
</style>
When to use
Use when each line should read as a small receipt card, with plenty of room for long product names at mobile widths.
Avoid
Do not use cards for a large invoice whose repeated values are easier to compare in a table.
Accessibility
Each product has a heading and explicit quantity and price labels; no label exists only in CSS. Theme token text pairs reach at least 6.2:1 in light and 6.8:1 in dark.
Was this useful? Send feedback.