Bootstrap 5 Product Page with Image Carousel
A single product page with an image carousel and thumbnail strip, price and offers, storage options, delivery info and add-to-cart actions.
<section class="wdw-stage pd-stage">
<div class="container pd-container">
<div class="wdw-card overflow-hidden">
<div class="row g-0">
<div class="col-lg-6">
<div class="pd-media h-100 p-3 p-md-4">
<div id="pdCarousel" class="carousel slide rounded-4 overflow-hidden" data-bs-ride="false" role="group" aria-roledescription="carousel" aria-label="Product photos">
<div class="carousel-inner"><div class="carousel-item active"><img src="https://images.unsplash.com/photo-1496181133206-80ce9b88a853?w=1000&q=80&fm=jpg" class="d-block w-100" alt="Silver laptop open on a light wooden desk"></div><div class="carousel-item"><img src="https://images.unsplash.com/photo-1541807084-5c52b6b3adef?w=1000&q=80&fm=jpg" class="d-block w-100" alt="Slim laptop showing a landscape wallpaper on a wooden table" loading="lazy"></div><div class="carousel-item"><img src="https://images.unsplash.com/photo-1611186871348-b1ce696e52c9?w=1000&q=80&fm=jpg" class="d-block w-100" alt="Back lid of a silver laptop on a grey surface" loading="lazy"></div><div class="carousel-item"><img src="https://images.unsplash.com/photo-1593642632823-8f785ba67e45?w=1000&q=80&fm=jpg" class="d-block w-100" alt="Laptop screen with colourful abstract artwork" loading="lazy"></div></div>
<button class="carousel-control-prev" type="button" data-bs-target="#pdCarousel" data-bs-slide="prev" aria-label="Previous photo"><span class="pd-arrow"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg></span><span class="visually-hidden">Previous</span></button>
<button class="carousel-control-next" type="button" data-bs-target="#pdCarousel" data-bs-slide="next" aria-label="Next photo"><span class="pd-arrow"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></span><span class="visually-hidden">Next</span></button>
</div>
<div class="pd-thumbs d-flex gap-2 mt-3"><button type="button" data-bs-target="#pdCarousel" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Show photo 1: laptop open on a wooden desk"><img src="https://images.unsplash.com/photo-1496181133206-80ce9b88a853?w=160&h=160&fit=crop&q=70&fm=jpg" alt=""></button><button type="button" data-bs-target="#pdCarousel" data-bs-slide-to="1" aria-label="Show photo 2: laptop on a table with landscape wallpaper"><img src="https://images.unsplash.com/photo-1541807084-5c52b6b3adef?w=160&h=160&fit=crop&q=70&fm=jpg" alt=""></button><button type="button" data-bs-target="#pdCarousel" data-bs-slide-to="2" aria-label="Show photo 3: back lid of the laptop"><img src="https://images.unsplash.com/photo-1611186871348-b1ce696e52c9?w=160&h=160&fit=crop&q=70&fm=jpg" alt=""></button><button type="button" data-bs-target="#pdCarousel" data-bs-slide-to="3" aria-label="Show photo 4: screen with colourful abstract artwork"><img src="https://images.unsplash.com/photo-1593642632823-8f785ba67e45?w=160&h=160&fit=crop&q=70&fm=jpg" alt=""></button></div>
</div>
</div>
<div class="col-lg-6">
<div class="p-4 p-lg-4 p-xl-5">
<span class="wdw-eyebrow">Laptops</span>
<h2 class="wdw-heading h4 mt-1 mb-2">Aero Air 13 · 8GB RAM / 256GB SSD</h2>
<div class="d-flex align-items-center gap-2 small mb-3">
<span class="pd-stars" role="img" aria-label="Rated 4.7 out of 5"><span class="pd-stars-bg"><svg width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg></span><span class="pd-stars-fg" style="width:94%"><span><svg width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg></span></span></span>
<span class="fw-semibold" aria-hidden="true">4.7</span><span class="wdw-muted">1,200 ratings · 564 reviews</span>
</div>
<div class="d-flex align-items-baseline flex-wrap gap-2 mb-3">
<span class="fs-1 fw-bold text-body-emphasis" id="pdPrice" aria-live="polite">$749</span>
<s class="wdw-muted" id="pdList"><span class="visually-hidden">Original price </span>$999</s>
<span class="badge rounded-pill bg-success-subtle text-success-emphasis" id="pdOff">25% off</span>
</div>
<ul class="list-unstyled d-grid gap-2 mb-3 p-3 rounded-4 bg-body-tertiary"><li class="d-flex flex-column flex-sm-row gap-1 gap-sm-2 small"><span class="badge rounded-pill bg-primary-subtle text-primary-emphasis align-self-start flex-none pd-tag">Credit card</span><span class="text-body-secondary">20% instant discount on SBI credit cards</span></li><li class="d-flex flex-column flex-sm-row gap-1 gap-sm-2 small"><span class="badge rounded-pill bg-primary-subtle text-primary-emphasis align-self-start flex-none pd-tag">Cashback</span><span class="text-body-secondary">5% unlimited cashback on Axis Bank credit card</span></li><li class="d-flex flex-column flex-sm-row gap-1 gap-sm-2 small"><span class="badge rounded-pill bg-primary-subtle text-primary-emphasis align-self-start flex-none pd-tag">Bank offer</span><span class="text-body-secondary">Extra 5% off with Axis Bank Buzz credit card</span></li><li class="d-flex flex-column flex-sm-row gap-1 gap-sm-2 small"><span class="badge rounded-pill bg-primary-subtle text-primary-emphasis align-self-start flex-none pd-tag">Wallet</span><span class="text-body-secondary">20% instant discount when paying with Google Wallet</span></li></ul>
<div class="d-flex align-items-center gap-2 small mb-3">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" class="text-primary" aria-hidden="true"><rect x="1" y="6" width="14" height="11" rx="1"/><path d="M15 9h4l3 3v5h-7"/><circle cx="6" cy="18" r="2"/><circle cx="18" cy="18" r="2"/></svg>
<span>Delivery by <strong>Tuesday, 23 Jul</strong></span><span class="badge rounded-pill bg-success-subtle text-success-emphasis">Free</span>
</div>
<fieldset class="mb-3">
<legend class="fs-6 fw-semibold mb-2">Storage</legend>
<div class="d-flex flex-wrap gap-2"><input type="radio" class="btn-check" name="pdStorage" id="pdS128" value="128" checked><label class="btn btn-outline-secondary pd-opt rounded-pill" for="pdS128">128 GB</label><input type="radio" class="btn-check" name="pdStorage" id="pdS256" value="256"><label class="btn btn-outline-secondary pd-opt rounded-pill" for="pdS256">256 GB</label><input type="radio" class="btn-check" name="pdStorage" id="pdS512" value="512"><label class="btn btn-outline-secondary pd-opt rounded-pill" for="pdS512">512 GB</label></div>
</fieldset>
<div class="small wdw-muted mb-4">Seller: <span class="fw-semibold text-body">Sargam Electronics</span></div>
<div class="d-flex flex-wrap gap-2">
<button type="button" class="btn btn-outline-primary rounded-pill px-4 flex-grow-1" id="pdAdd">Add to cart</button>
<button type="button" class="btn btn-primary rounded-pill px-4 flex-grow-1">Buy now</button>
</div>
</div>
</div>
</div>
</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 */
.pd-media { background: var(--bs-tertiary-bg); }
.pd-media .carousel-item img { aspect-ratio: 4 / 3; object-fit: cover; }
.pd-arrow { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255,255,255,.92); color: #1f2330; box-shadow: 0 2px 8px rgba(16,24,40,.25); }
.carousel-control-prev, .carousel-control-next { width: 4.5rem; opacity: 1; }
.carousel-control-prev:hover .pd-arrow, .carousel-control-next:hover .pd-arrow { background: #fff; }
.pd-thumbs button { width: 72px; height: 56px; padding: 0; border: 2px solid transparent; border-radius: .75rem; overflow: hidden; background: none; opacity: .65; transition: opacity .2s, border-color .2s; }
.pd-thumbs button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pd-thumbs button:hover { opacity: 1; }
.pd-thumbs button.active { border-color: var(--bs-primary); opacity: 1; }
.pd-thumbs button:focus-visible { outline: 3px solid var(--bs-focus-ring-color); outline-offset: 2px; }
.pd-opt { --bs-btn-color: var(--bs-body-color); --bs-btn-border-color: var(--bs-border-color); min-width: 5.5rem; }
.btn-check:checked + .pd-opt { background: var(--bs-primary-bg-subtle); border-color: var(--bs-primary); color: var(--bs-primary-text-emphasis); }
.btn-check:focus-visible + .pd-opt { box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.flex-none { flex: none; }
.pd-stage { padding-block: 1.5rem; }
.pd-container { max-width: 1180px; }
.pd-tag { min-width: 6rem; text-align: center; }
.pd-stars { position: relative; display: inline-flex; line-height: 0; }
.pd-stars svg { fill: currentColor; flex: none; }
.pd-stars-bg { display: inline-flex; color: var(--bs-border-color); }
.pd-stars-fg { position: absolute; inset: 0 auto 0 0; overflow: hidden; color: var(--bs-warning); }
.pd-stars-fg > span { display: inline-flex; }
(function () {
function initThumbs() {
var car = document.getElementById('pdCarousel');
var thumbs = document.querySelectorAll('.pd-thumbs button');
if (!car || !thumbs.length) return;
car.addEventListener('slide.bs.carousel', function (e) {
thumbs.forEach(function (t, i) {
var on = i === e.to;
t.classList.toggle('active', on);
if (on) t.setAttribute('aria-current', 'true'); else t.removeAttribute('aria-current');
});
});
}
function initStorage() {
var price = document.getElementById('pdPrice');
if (!price) return;
var list = document.getElementById('pdList');
var off = document.getElementById('pdOff');
var prices = { '128': ['$749', '$999', '25% off'], '256': ['$899', '$1,149', '22% off'], '512': ['$1,099', '$1,399', '21% off'] };
document.querySelectorAll('input[name="pdStorage"]').forEach(function (r) {
r.addEventListener('change', function () { var p = prices[r.value];
price.textContent = p[0];
if (list) list.lastChild.textContent = p[1];
if (off) off.textContent = p[2];
});
});
}
function initCart() {
var btn = document.getElementById('pdAdd');
if (!btn) return;
btn.addEventListener('click', function () {
btn.textContent = 'Added ✓';
setTimeout(function () { btn.textContent = 'Add to cart'; }, 1600);
});
}
initThumbs(); initStorage(); initCart();
})();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.