Bootstrap 5 Weather Card with 5-Day Forecast
A weather card with a large current temperature, wind and humidity, and a five-day strip where choosing a day updates the summary above.
<section class="wdw-stage">
<div class="container" style="max-width: 600px">
<div class="wdw-card overflow-hidden wdw-weather">
<div class="wdw-aurora p-4 p-sm-5">
<div class="d-flex align-items-center gap-2 mb-1">
<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="M12 21s7-6 7-11a7 7 0 0 0-14 0c0 5 7 11 7 11z"/><circle cx="12" cy="10" r="2.5"/></svg>
<h1 class="h5 fw-bold mb-0">Moscow</h1>
<span class="small opacity-75">Red Square · Wednesday</span>
</div>
<div class="d-flex align-items-center justify-content-between gap-3 mt-3">
<div>
<div class="wdw-temp" id="wxTemp" aria-live="polite">-34°</div>
<p class="fs-5 fw-semibold mb-2" id="wxCond" aria-live="polite">Partly cloudy</p>
<div class="d-flex flex-wrap gap-3 small opacity-75">
<span>Wind <strong class="text-white" id="wxWind">15 km/h</strong></span>
<span>Humidity <strong class="text-white" id="wxHum">68%</strong></span>
</div>
</div>
<div class="wdw-weather-icon" id="wxIcon" aria-hidden="true"></div>
</div>
</div>
<div class="wdw-days p-2 p-sm-3" role="group" aria-label="Five day forecast, select a day">
<button type="button" class="wdw-day" aria-pressed="false" data-temp="-30" data-cond="Light snow" data-wind="12 km/h" data-hum="84%" data-icon="snow">
<span class="wdw-dname fw-semibold">Mon</span><span class="text-primary d-inline-flex"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 15a4 4 0 0 1-.5-7.9A5.5 5.5 0 0 1 17 7.5 4 4 0 0 1 17.5 15z"/><path d="M8 18.5h.01M12 19.5h.01M16 18.5h.01M10 21.5h.01M14 21.5h.01"/></svg></span>
<span class="wdw-lo">-33°</span>
<span class="wdw-range" aria-hidden="true"><span style="left:28%;width:20%"></span></span>
<span class="wdw-hi fw-bold">-28°</span>
</button>
<button type="button" class="wdw-day" aria-pressed="false" data-temp="-29" data-cond="Clear and bright" data-wind="8 km/h" data-hum="71%" data-icon="sun">
<span class="wdw-dname fw-semibold">Tue</span><span class="text-primary d-inline-flex"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2.5v2M12 19.5v2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M2.5 12h2M19.5 12h2M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"/></svg></span>
<span class="wdw-lo">-32°</span>
<span class="wdw-range" aria-hidden="true"><span style="left:32%;width:24%"></span></span>
<span class="wdw-hi fw-bold">-26°</span>
</button>
<button type="button" class="wdw-day active" aria-pressed="true" data-temp="-34" data-cond="Partly cloudy" data-wind="15 km/h" data-hum="68%" data-icon="partly">
<span class="wdw-dname fw-semibold">Wed</span><span class="text-primary d-inline-flex"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="9" cy="9" r="3"/><path d="M9 2.5v1.2M2.5 9h1.2M4.4 4.4l.9.9M13.6 4.4l-.9.9"/><path d="M7.5 20a4 4 0 0 1-.4-7.98 5.5 5.5 0 0 1 10.5 1.2A3.4 3.4 0 0 1 17 20z"/></svg></span>
<span class="wdw-lo">-37°</span>
<span class="wdw-range" aria-hidden="true"><span style="left:12%;width:24%"></span></span>
<span class="wdw-hi fw-bold">-31°</span>
</button>
<button type="button" class="wdw-day" aria-pressed="false" data-temp="-30" data-cond="Overcast" data-wind="10 km/h" data-hum="79%" data-icon="cloud">
<span class="wdw-dname fw-semibold">Thu</span><span class="text-primary d-inline-flex"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7.5 20a4 4 0 0 1-.4-7.98 5.5 5.5 0 0 1 10.5 1.2A3.4 3.4 0 0 1 17 20z"/></svg></span>
<span class="wdw-lo">-34°</span>
<span class="wdw-range" aria-hidden="true"><span style="left:24%;width:24%"></span></span>
<span class="wdw-hi fw-bold">-28°</span>
</button>
<button type="button" class="wdw-day" aria-pressed="false" data-temp="-30" data-cond="Snow showers" data-wind="18 km/h" data-hum="88%" data-icon="snow">
<span class="wdw-dname fw-semibold">Fri</span><span class="text-primary d-inline-flex"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 15a4 4 0 0 1-.5-7.9A5.5 5.5 0 0 1 17 7.5 4 4 0 0 1 17.5 15z"/><path d="M8 18.5h.01M12 19.5h.01M16 18.5h.01M10 21.5h.01M14 21.5h.01"/></svg></span>
<span class="wdw-lo">-33°</span>
<span class="wdw-range" aria-hidden="true"><span style="left:28%;width:24%"></span></span>
<span class="wdw-hi fw-bold">-27°</span>
</button>
</div>
<template data-icon-tpl="snow"><svg width="96" height="96" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path fill="currentColor" stroke="none" d="M7 15a4 4 0 0 1-.5-7.9A5.5 5.5 0 0 1 17 7.5 4 4 0 0 1 17.5 15z"/><path d="M8 18.5h.01M12 19.5h.01M16 18.5h.01M10 21.5h.01M14 21.5h.01" stroke-width="2.4"/></svg></template><template data-icon-tpl="sun"><svg width="96" height="96" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4.2" fill="currentColor" stroke="none"/><path d="M12 2.5v2M12 19.5v2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M2.5 12h2M19.5 12h2M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"/></svg></template><template data-icon-tpl="cloud"><svg width="96" height="96" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path fill="currentColor" stroke="none" d="M7.5 20a4 4 0 0 1-.4-7.98 5.5 5.5 0 0 1 10.5 1.2A3.4 3.4 0 0 1 17 20z"/></svg></template><template data-icon-tpl="partly"><svg width="96" height="96" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="9" cy="9" r="3.3" fill="currentColor" fill-opacity=".55" stroke="none"/><path d="M9 2v1.4M2 9h1.4M4 4l1 1M14 4l-1 1M4 14l1-1" stroke-width="1.4"/><path fill="currentColor" stroke="none" d="M7.5 20a4 4 0 0 1-.4-7.98 5.5 5.5 0 0 1 10.5 1.2A3.4 3.4 0 0 1 17 20z"/></svg></template>
</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 */
.wdw-temp { font-size: 5rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.wdw-weather-icon { display: inline-flex; color: rgba(255,255,255,.95); flex: none; }
.wdw-weather-icon svg { width: 6rem; height: 6rem; }
.wdw-days { display: flex; flex-direction: column; gap: .15rem; }
.wdw-day { display: grid; grid-template-columns: 3rem 1.5rem 2.5rem 1fr 2.5rem; align-items: center; gap: .75rem; padding: .6rem .85rem; min-height: 48px; border: 0; border-radius: 1rem; background: transparent; color: var(--bs-body-color); text-align: left; transition: background .2s; }
.wdw-day:hover { background: var(--bs-tertiary-bg); }
.wdw-day.active { background: var(--bs-primary-bg-subtle); }
.wdw-dname { color: var(--bs-body-color); }
.wdw-lo { color: var(--bs-secondary-color); text-align: right; font-variant-numeric: tabular-nums; }
.wdw-hi { font-variant-numeric: tabular-nums; }
.wdw-range { position: relative; height: 6px; border-radius: 6px; background: var(--bs-border-color); }
.wdw-range span { position: absolute; top: 0; bottom: 0; border-radius: 6px; background: var(--bs-primary); }
.wdw-day:focus-visible { outline: 3px solid var(--bs-primary); outline-offset: -2px; }
@media (max-width: 400px) { .wdw-temp { font-size: 3.75rem; } .wdw-weather-icon svg { width: 4.5rem; height: 4.5rem; } .wdw-day { gap: .5rem; padding-inline: .5rem; } }
function initWeather() {
var root = document.querySelector('.wdw-weather');
if (!root) return;
var days = root.querySelectorAll('.wdw-day');
var icon = document.getElementById('wxIcon');
function show(btn) {
days.forEach(function (d) {
var on = d === btn;
d.classList.toggle('active', on);
d.setAttribute('aria-pressed', on);
});
document.getElementById('wxTemp').textContent = btn.dataset.temp + '°';
document.getElementById('wxCond').textContent = btn.dataset.cond;
document.getElementById('wxWind').textContent = btn.dataset.wind;
document.getElementById('wxHum').textContent = btn.dataset.hum;
var tpl = root.querySelector('template[data-icon-tpl="' + btn.dataset.icon + '"]');
if (tpl && icon) icon.innerHTML = tpl.innerHTML;
}
days.forEach(function (btn, i) {
btn.addEventListener('click', function () { show(btn); });
});
show(root.querySelector('.wdw-day.active') || days[0]);
}
initWeather();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.