Bootstrap 5 Profile Cards with CSS Scroll Snap
A horizontally scrolling row of portrait profile cards that snap into place, with name and role over a soft scrim. Previous and next buttons and the arrow keys move through the row.
<section class="wdw-stage overflow-hidden">
<div class="container" style="max-width:1040px">
<div class="d-flex flex-wrap align-items-end justify-content-between gap-3 mb-3">
<div>
<span class="wdw-eyebrow">Team</span>
<h1 class="wdw-heading h2 mt-1 mb-0">Meet the crew</h1>
</div>
<div class="d-flex align-items-center gap-3">
<span class="small fw-semibold wdw-muted" id="snapCount" aria-live="polite">1 / 6</span>
<div class="d-flex gap-2"><button type="button" class="btn btn-outline-primary rounded-circle p-0 snap-nav" data-dir="-1" aria-label="Previous profiles"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 6-6 6 6 6"/></svg></button><button type="button" class="btn btn-outline-primary rounded-circle p-0 snap-nav" data-dir="1" aria-label="Next profiles"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 6 6 6-6 6"/></svg></button></div>
</div>
</div>
<div class="snap-track" id="snapTrack" tabindex="0" role="region" aria-label="Team profiles, scrollable">
<article class="snap-card">
<img src="https://images.unsplash.com/photo-1500648767791-00dcc994a43e?auto=format&fit=crop&crop=faces&w=480&h=640&q=70" alt="" loading="lazy">
<div class="snap-actions"><a href="#" class="snap-act" aria-label="Email Axel Brandt"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="m3 7 9 6 9-6"/></svg></a><a href="#" class="snap-act" aria-label="Message Axel Brandt"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a8 8 0 0 1-11.6 7.1L3 20l1-4.6A8 8 0 1 1 21 12z"/></svg></a></div>
<div class="snap-info"><div class="snap-chip"><h2 class="h6 mb-1">Axel Brandt</h2><span class="badge rounded-pill snap-role">Engineering lead</span></div></div>
</article>
<article class="snap-card">
<img src="https://images.unsplash.com/photo-1494790108377-be9c29b29330?auto=format&fit=crop&crop=faces&w=480&h=640&q=70" alt="" loading="lazy">
<div class="snap-actions"><a href="#" class="snap-act" aria-label="Email Maya Ortiz"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="m3 7 9 6 9-6"/></svg></a><a href="#" class="snap-act" aria-label="Message Maya Ortiz"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a8 8 0 0 1-11.6 7.1L3 20l1-4.6A8 8 0 1 1 21 12z"/></svg></a></div>
<div class="snap-info"><div class="snap-chip"><h2 class="h6 mb-1">Maya Ortiz</h2><span class="badge rounded-pill snap-role">Product designer</span></div></div>
</article>
<article class="snap-card">
<img src="https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?auto=format&fit=crop&crop=faces&w=480&h=640&q=70" alt="" loading="lazy">
<div class="snap-actions"><a href="#" class="snap-act" aria-label="Email Tom Reyes"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="m3 7 9 6 9-6"/></svg></a><a href="#" class="snap-act" aria-label="Message Tom Reyes"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a8 8 0 0 1-11.6 7.1L3 20l1-4.6A8 8 0 1 1 21 12z"/></svg></a></div>
<div class="snap-info"><div class="snap-chip"><h2 class="h6 mb-1">Tom Reyes</h2><span class="badge rounded-pill snap-role">Frontend developer</span></div></div>
</article>
<article class="snap-card">
<img src="https://images.unsplash.com/photo-1438761681033-6461ffad8d80?auto=format&fit=crop&crop=faces&w=480&h=640&q=70" alt="" loading="lazy">
<div class="snap-actions"><a href="#" class="snap-act" aria-label="Email Priya Nair"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="m3 7 9 6 9-6"/></svg></a><a href="#" class="snap-act" aria-label="Message Priya Nair"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a8 8 0 0 1-11.6 7.1L3 20l1-4.6A8 8 0 1 1 21 12z"/></svg></a></div>
<div class="snap-info"><div class="snap-chip"><h2 class="h6 mb-1">Priya Nair</h2><span class="badge rounded-pill snap-role">Data analyst</span></div></div>
</article>
<article class="snap-card">
<img src="https://images.unsplash.com/photo-1519085360753-af0119f7cbe7?auto=format&fit=crop&crop=faces&w=480&h=640&q=70" alt="" loading="lazy">
<div class="snap-actions"><a href="#" class="snap-act" aria-label="Email Daniel Cho"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="m3 7 9 6 9-6"/></svg></a><a href="#" class="snap-act" aria-label="Message Daniel Cho"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a8 8 0 0 1-11.6 7.1L3 20l1-4.6A8 8 0 1 1 21 12z"/></svg></a></div>
<div class="snap-info"><div class="snap-chip"><h2 class="h6 mb-1">Daniel Cho</h2><span class="badge rounded-pill snap-role">Customer success</span></div></div>
</article>
<article class="snap-card">
<img src="https://images.unsplash.com/photo-1534528741775-53994a69daeb?auto=format&fit=crop&crop=faces&w=480&h=640&q=70" alt="" loading="lazy">
<div class="snap-actions"><a href="#" class="snap-act" aria-label="Email Lena Fischer"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="m3 7 9 6 9-6"/></svg></a><a href="#" class="snap-act" aria-label="Message Lena Fischer"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a8 8 0 0 1-11.6 7.1L3 20l1-4.6A8 8 0 1 1 21 12z"/></svg></a></div>
<div class="snap-info"><div class="snap-chip"><h2 class="h6 mb-1">Lena Fischer</h2><span class="badge rounded-pill snap-role">Marketing</span></div></div>
</article>
</div>
<div class="snap-dots d-flex justify-content-center gap-2" id="snapDots" aria-hidden="true"></div>
</div>
</section>
/* Web Designer Wall library style — shared base for every Bootstrap 5 snippet.
Indigo accent, Plus Jakarta Sans, soft cards, pill buttons. Works in light and dark. */
@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");
:root,
[data-bs-theme="light"] {
--wdw-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
--bs-body-font-family: var(--wdw-font);
--bs-primary: #4f46e5;
--bs-primary-rgb: 79, 70, 229;
--bs-primary-text-emphasis: #3730a3;
--bs-primary-bg-subtle: #eef2ff;
--bs-primary-border-subtle: #c7d2fe;
--bs-link-color: #4f46e5;
--bs-link-color-rgb: 79, 70, 229;
--bs-link-hover-color: #4338ca;
--bs-link-hover-color-rgb: 67, 56, 202;
--bs-focus-ring-color: rgba(79, 70, 229, 0.25);
--bs-border-radius: 0.75rem;
--bs-border-radius-lg: 1rem;
--bs-border-radius-xl: 1.25rem;
--wdw-radius-card: 1.25rem;
--wdw-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 16px 40px -16px rgba(16, 24, 40, 0.22);
--wdw-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px -4px rgba(16, 24, 40, 0.12);
--wdw-stage: #f5f6fb;
}
[data-bs-theme="dark"] {
--bs-primary: #818cf8;
--bs-primary-rgb: 129, 140, 248;
--bs-primary-text-emphasis: #c7d2fe;
--bs-primary-bg-subtle: rgba(129, 140, 248, 0.14);
--bs-primary-border-subtle: rgba(129, 140, 248, 0.35);
--bs-link-color: #a5b4fc;
--bs-link-color-rgb: 165, 180, 252;
--bs-link-hover-color: #c7d2fe;
--bs-link-hover-color-rgb: 199, 210, 254;
--bs-focus-ring-color: rgba(129, 140, 248, 0.35);
--wdw-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -16px rgba(0, 0, 0, 0.7);
--wdw-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px -4px rgba(0, 0, 0, 0.5);
--wdw-stage: #0f1117;
}
body { font-family: var(--wdw-font); -webkit-font-smoothing: antialiased; }
/* Bootstrap compiles its blue into these components; point them at the accent. */
.btn-primary {
--bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
--bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca;
--bs-btn-active-bg: #3730a3; --bs-btn-active-border-color: #3730a3;
--bs-btn-disabled-bg: var(--bs-primary); --bs-btn-disabled-border-color: var(--bs-primary);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #0f1117; --bs-btn-hover-bg: #a5b4fc; --bs-btn-hover-border-color: #a5b4fc; --bs-btn-hover-color: #0f1117; --bs-btn-active-color: #0f1117; }
.btn-outline-primary {
--bs-btn-color: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
--bs-btn-hover-bg: var(--bs-primary); --bs-btn-hover-border-color: var(--bs-primary);
--bs-btn-active-bg: var(--bs-primary); --bs-btn-active-border-color: var(--bs-primary);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
.btn { --bs-btn-font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.btn-sm { min-height: 36px; }
.form-control, .form-select { min-height: 44px; border-radius: .75rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: rgba(var(--bs-primary-rgb), .6); box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--bs-primary); }
.nav { --bs-nav-link-color: var(--bs-secondary-color); --bs-nav-link-hover-color: var(--bs-emphasis-color); }
.pagination { --bs-pagination-active-bg: var(--bs-primary); --bs-pagination-active-border-color: var(--bs-primary); --bs-pagination-color: var(--bs-body-color); --bs-pagination-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.progress, .progress-stacked { --bs-progress-bar-bg: var(--bs-primary); }
.list-group { --bs-list-group-active-bg: var(--bs-primary); --bs-list-group-active-border-color: var(--bs-primary); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--bs-primary); border-radius: .875rem; box-shadow: var(--wdw-shadow-sm); }
.accordion { --bs-accordion-active-bg: var(--bs-primary-bg-subtle); --bs-accordion-active-color: var(--bs-primary-text-emphasis); --bs-accordion-btn-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.badge { font-weight: 600; }
/* Library building blocks — use these instead of re-inventing them per snippet. */
.wdw-stage { min-height: 100vh; display: flex; align-items: center; background: var(--wdw-stage); padding-block: 3rem; }
.wdw-card { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: var(--wdw-radius-card); box-shadow: var(--wdw-shadow); }
.wdw-card-sm { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: 1rem; box-shadow: var(--wdw-shadow-sm); }
.wdw-aurora { position: relative; color: #fff; background: radial-gradient(60% 55% at 100% 0, #818cf8 0, transparent 70%), radial-gradient(65% 60% at 0 100%, #ec4899 0, transparent 65%), #1e1b4b; }
.wdw-eyebrow { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bs-primary); }
.wdw-heading { font-weight: 800; letter-spacing: -.02em; color: var(--bs-emphasis-color); }
.wdw-muted { color: var(--bs-secondary-color); }
.wdw-icon { width: 2.75rem; height: 2.75rem; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: .875rem; background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
/* Component */
.snap-track { display: flex; gap: 1.25rem; overflow-x: auto; scroll-snap-type: x mandatory; --bleed: calc((100vw - min(100vw, 1040px)) / 2 + 12px); margin-inline: calc(-1 * var(--bleed)); padding: 1.25rem var(--bleed) 2rem; scroll-padding-inline: var(--bleed); scrollbar-width: none; }
.snap-track::-webkit-scrollbar { display: none; }
.snap-track:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: -2px; }
.snap-nav { width: 44px; flex: none; }
.snap-nav:disabled { opacity: .35; }
.snap-card { position: relative; flex: 0 0 min(240px, 72%); aspect-ratio: 3 / 4; border-radius: 1.25rem; overflow: hidden; scroll-snap-align: start; box-shadow: var(--wdw-shadow); background: var(--bs-tertiary-bg); transform: scale(.96); transition: transform .35s ease, box-shadow .35s ease; }
.snap-card.is-active { transform: scale(1); box-shadow: 0 1px 2px rgba(16,24,40,.06), 0 24px 44px -16px rgba(79,70,229,.45); }
.snap-card:hover { transform: translateY(-6px) scale(1); }
.snap-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.snap-info { position: absolute; inset: auto .75rem .75rem .75rem; }
.snap-chip { padding: .7rem .9rem; border-radius: 1rem; color: #fff; background: rgba(15,17,23,.45); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,.18); }
.snap-role { background: #4f46e5; color: #fff; font-size: .72rem; }
.snap-actions { position: absolute; top: .75rem; right: .75rem; display: flex; flex-direction: column; gap: .5rem; opacity: 0; transform: translateX(8px); transition: opacity .25s ease, transform .25s ease; }
.snap-card:hover .snap-actions, .snap-card:focus-within .snap-actions { opacity: 1; transform: none; }
@media (hover: none) { .snap-actions { opacity: 1; transform: none; } }
.snap-act { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; background: rgba(15,17,23,.45); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.2); }
.snap-act:hover, .snap-act:focus-visible { background: #4f46e5; color: #fff; outline: 2px solid #fff; outline-offset: 2px; }
.snap-dots span { width: .5rem; height: .5rem; border-radius: 50rem; background: var(--bs-border-color); transition: width .25s ease, background .25s ease; }
.snap-dots span.on { width: 1.5rem; background: var(--bs-primary); }
@media (prefers-reduced-motion: reduce) { .snap-card, .snap-actions, .snap-dots span { transition: none; } .snap-track { scroll-behavior: auto; } }
(function () {
function initSnapNav() {
var track = document.getElementById('snapTrack');
if (!track) return;
var cards = track.querySelectorAll('.snap-card');
var buttons = document.querySelectorAll('.snap-nav');
var count = document.getElementById('snapCount');
var dots = document.getElementById('snapDots');
var reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
function step() {
var gap = parseFloat(getComputedStyle(track).columnGap) || 0;
return cards[0].offsetWidth + gap;
}
function scrollByCards(dir) {
track.scrollBy({ left: step() * dir, behavior: reduce ? 'auto' : 'smooth' });
}
function update() {
var max = track.scrollWidth - track.clientWidth;
var idx = Math.min(cards.length - 1, Math.round(track.scrollLeft / step()));
if (track.scrollLeft >= max - 2) idx = cards.length - 1;
buttons.forEach(function (b) {
b.disabled = Number(b.dataset.dir) < 0 ? track.scrollLeft <= 2 : track.scrollLeft >= max - 2;
});
cards.forEach(function (c, i) { c.classList.toggle('is-active', i === idx); });
if (count) count.textContent = (idx + 1) + ' / ' + cards.length;
if (dots) Array.prototype.forEach.call(dots.children, function (d, i) { d.classList.toggle('on', i === idx); });
}
if (dots) cards.forEach(function () { dots.appendChild(document.createElement('span')); });
buttons.forEach(function (btn) {
btn.addEventListener('click', function () { scrollByCards(Number(btn.dataset.dir)); });
});
track.addEventListener('keydown', function (e) {
if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
e.preventDefault();
scrollByCards(e.key === 'ArrowRight' ? 1 : -1);
}
});
track.addEventListener('scroll', function () { window.requestAnimationFrame(update); }, { passive: true });
window.addEventListener('resize', update);
update();
}
initSnapNav();
})();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.