CardsFree
Dialog box layout (static)
A static layout of a confirmation box with two buttons. It does not open or close; it has no script.
Four card layouts on one auto-fit grid: stacked, horizontal, a whole-card link and a compact list, with light and dark colours.
Checked on 3 December 2026 in Chrome 143.0.7499.169: 12 automated checks. What the checks are
<section class="cdl" aria-labelledby="cdl-title">
<h2 id="cdl-title" class="cdl__heading">Four card layouts, one grid</h2>
<div class="cdl__grid">
<article class="cdl__card cdl__card--stacked" aria-labelledby="cdl-t1">
<svg class="cdl__art" viewBox="0 0 320 150" preserveAspectRatio="xMidYMid slice" aria-hidden="true" focusable="false">
<rect class="cdl__a-bg" width="320" height="150"/>
<circle class="cdl__a-sun" cx="236" cy="48" r="26"/>
<path class="cdl__a-hill1" d="M0 150V104c40-26 84-30 130-6s92 6 190-14v66z"/>
<path class="cdl__a-hill2" d="M0 150v-26c58-22 112-10 164 4s104 6 156-10v32z"/>
</svg>
<div class="cdl__body">
<p class="cdl__tag">Stacked</p>
<h3 class="cdl__title" id="cdl-t1">Picture on top</h3>
<p class="cdl__text">The classic layout. An image, a label, a heading and two lines of text keep a list of cards easy to scan.</p>
<p class="cdl__meta">Example · 3 min read</p>
</div>
</article>
<article class="cdl__card cdl__card--link" aria-labelledby="cdl-t2">
<div class="cdl__body">
<p class="cdl__tag">Link card</p>
<h3 class="cdl__title" id="cdl-t2"><a class="cdl__anchor" href="#cdl-details">The whole card is the link</a></h3>
<p class="cdl__text">One link with a stretched hit area, so a tap anywhere works but screen readers meet a single link.</p>
<span class="cdl__go" aria-hidden="true">Read more <svg viewBox="0 0 20 20" width="18" height="18" focusable="false"><path d="M4 10h11M11 5l5 5-5 5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></span>
</div>
</article>
<article class="cdl__card cdl__card--list" aria-labelledby="cdl-t4">
<div class="cdl__body">
<p class="cdl__tag">Compact list</p>
<h3 class="cdl__title" id="cdl-t4">A short reading list</h3>
<ol class="cdl__items">
<li class="cdl__item"><span class="cdl__num" aria-hidden="true">1</span><span class="cdl__item-text"><span class="cdl__item-title">Spacing with gap</span><span class="cdl__meta">2 min</span></span></li>
<li class="cdl__item"><span class="cdl__num" aria-hidden="true">2</span><span class="cdl__item-text"><span class="cdl__item-title">Auto-fit columns</span><span class="cdl__meta">4 min</span></span></li>
<li class="cdl__item"><span class="cdl__num" aria-hidden="true">3</span><span class="cdl__item-text"><span class="cdl__item-title">Equal-height rows</span><span class="cdl__meta">3 min</span></span></li>
</ol>
</div>
</article>
<article class="cdl__card cdl__card--wide" id="cdl-details" aria-labelledby="cdl-t3">
<svg class="cdl__art cdl__art--side" viewBox="0 0 160 160" preserveAspectRatio="xMidYMid slice" aria-hidden="true" focusable="false">
<rect class="cdl__b-bg" width="160" height="160"/>
<circle class="cdl__b-ring" cx="80" cy="80" r="46"/>
<circle class="cdl__b-dot" cx="80" cy="80" r="22"/>
<rect class="cdl__b-bar" x="18" y="132" width="124" height="10" rx="5"/>
</svg>
<div class="cdl__body">
<p class="cdl__tag">Horizontal</p>
<h3 class="cdl__title" id="cdl-t3">Picture beside the text</h3>
<p class="cdl__text">Wide cards suit a featured item. The picture sits at the side and moves above the text when the space gets narrow.</p>
<p class="cdl__actions"><button type="button" class="cdl__btn">Open</button><span class="cdl__meta">Example · 5 min read</span></p>
</div>
</article>
</div>
</section>.cdl {
--cdl-surface: #ffffff;
--cdl-fg: #1b2032;
--cdl-muted: #4a5266;
--cdl-line: #d3d8e6;
--cdl-accent: #4338ca;
--cdl-soft: #eceeff;
--cdl-ring: #4338ca;
--cdl-on-accent: #ffffff;
box-sizing: border-box;
width: min(100%, 46rem);
color: var(--cdl-fg);
}
.cdl *, .cdl *::before, .cdl *::after { box-sizing: border-box; }
.cdl__heading { margin: 0 0 1rem; font-size: 1.25rem; letter-spacing: -0.01em; }
.cdl__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12.5rem), 1fr)); gap: 1rem; }
.cdl__card {
position: relative;
display: flex;
flex-direction: column;
overflow: hidden;
background: var(--cdl-surface);
border: 1px solid var(--cdl-line);
border-radius: 16px;
box-shadow: 0 6px 14px -10px rgba(27, 32, 50, 0.5);
transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.cdl__body { display: flex; flex-direction: column; flex: 1; padding: 1rem 1rem 1.1rem; }
.cdl__art { display: block; width: 100%; height: 7rem; }
.cdl__tag { align-self: flex-start; margin: 0 0 0.6rem; padding: 0.15rem 0.6rem; color: var(--cdl-accent); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; background: var(--cdl-soft); border-radius: 999px; }
.cdl__title { margin: 0 0 0.4rem; font-size: 1.125rem; line-height: 1.3; letter-spacing: -0.01em; }
.cdl__text { margin: 0 0 0.8rem; color: var(--cdl-muted); font-size: 0.875rem; line-height: 1.55; }
.cdl__meta { margin: auto 0 0; color: var(--cdl-muted); font-size: 0.8125rem; }
/* art colours */
.cdl__a-bg { fill: #dfe3ff; } .cdl__a-sun { fill: #f5b546; } .cdl__a-hill1 { fill: #7a7fe6; } .cdl__a-hill2 { fill: #4338ca; }
.cdl__b-bg { fill: #e6f3ee; } .cdl__b-ring { fill: none; stroke: #2a9d78; stroke-width: 10; } .cdl__b-dot { fill: #f08a4b; } .cdl__b-bar { fill: #2a9d78; }
/* link card */
.cdl__card--link { background: var(--cdl-soft); }
.cdl__card--link .cdl__tag { background: var(--cdl-surface); }
.cdl__anchor { color: inherit; text-decoration: none; }
.cdl__anchor::after { content: ""; position: absolute; inset: 0; border-radius: 16px; }
.cdl__anchor:focus-visible { outline: 3px solid var(--cdl-ring); outline-offset: 3px; border-radius: 4px; }
.cdl__card--link:has(.cdl__anchor:focus-visible) { border-color: var(--cdl-ring); box-shadow: 0 0 0 3px var(--cdl-ring); }
.cdl__go { display: inline-flex; align-items: center; gap: 0.4rem; margin-top: auto; color: var(--cdl-accent); font-weight: 700; }
.cdl__go svg { transition: transform 0.2s ease; }
.cdl__card--link:hover { border-color: var(--cdl-accent); }
.cdl__card--link:hover .cdl__go svg { transform: translateX(4px); }
@media (hover: hover) { .cdl__card--link:hover { transform: translateY(-4px); box-shadow: 0 18px 30px -18px rgba(67, 56, 202, 0.6); } }
/* horizontal */
.cdl__card--wide { grid-column: 1 / -1; flex-direction: row; }
.cdl__card--wide:target { border-color: var(--cdl-accent); }
.cdl__art--side { flex: none; width: 10rem; height: auto; min-height: 11rem; }
.cdl__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin: auto 0 0; }
.cdl__btn { min-height: 44px; padding: 0.45rem 1.1rem; font: inherit; font-weight: 600; color: var(--cdl-on-accent); background: var(--cdl-accent); border: 2px solid var(--cdl-accent); border-radius: 10px; cursor: pointer; }
.cdl__btn:hover { filter: brightness(1.1); }
.cdl__btn:focus-visible { outline: 3px solid var(--cdl-ring); outline-offset: 2px; }
.cdl__actions .cdl__meta { margin: 0; }
/* compact list */
.cdl__items { display: grid; gap: 0.5rem; margin: 0.2rem 0 0; padding: 0; list-style: none; }
.cdl__item { display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0.65rem; background: var(--cdl-soft); border-radius: 10px; }
.cdl__num { display: grid; place-items: center; flex: none; width: 1.9rem; height: 1.9rem; color: var(--cdl-on-accent); font-size: 0.875rem; font-weight: 700; background: var(--cdl-accent); border-radius: 50%; }
.cdl__item-text { display: flex; flex: 1; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 0.75rem; min-width: 0; }
.cdl__item-title { font-weight: 600; font-size: 0.9375rem; }
.cdl__item-text .cdl__meta { margin: 0; }
@media (max-width: 34em) {
.cdl__card--wide { flex-direction: column; }
.cdl__art--side { width: 100%; min-height: 0; height: 9rem; }
}
@media (prefers-color-scheme: dark) {
.cdl {
--cdl-surface: #1a1e2e;
--cdl-fg: #edf0fa;
--cdl-muted: #b9bfd3;
--cdl-line: #3a4157;
--cdl-accent: #aeb1ff;
--cdl-soft: #272c47;
--cdl-ring: #c9cbff;
--cdl-on-accent: #14162b;
}
.cdl__card { box-shadow: none; }
.cdl__a-bg { fill: #262b4a; } .cdl__a-sun { fill: #f2b84b; } .cdl__a-hill1 { fill: #5b60c9; } .cdl__a-hill2 { fill: #8f93f5; }
.cdl__b-bg { fill: #1c3a33; } .cdl__b-ring { stroke: #5fd4ae; } .cdl__b-bar { fill: #5fd4ae; } .cdl__b-dot { fill: #f4a26b; }
}
@media (prefers-reduced-motion: reduce) {
.cdl__card, .cdl__go svg { transition: none; }
.cdl__card--link:hover { transform: none; }
.cdl__card--link:hover .cdl__go svg { transform: none; }
}Written by the author of the snippet. Each note has a test step or a markup check that reads the page.
CardsA static layout of a confirmation box with two buttons. It does not open or close; it has no script.
CardsA clean and modern user profile card with avatar, social links, and bio section. Perfect for user profiles, team pages, or portfolio websites. Fully responsive and customizable.
CardsA quote with the name of its source, on a card with a coloured edge. The text is placeholder text.