A set of clickable Bootstrap 6 cards that rise and gain a soft violet shadow when you hover them or reach them with the keyboard. Here they present learning paths on a course site, but the same pattern fits feature tiles, pricing options, blog teasers or dashboard shortcuts.
How it works
The section .hlc-root is pinned to data-bs-theme="light". The cards sit in a Bootstrap grid: row g-7 with col-12 md:col-6 lg:col-3, so they show one per row on phones, two from 768px and four from 1024px.
Each card is article.card.hover-lift.hlc-card. hover-lift is a new Bootstrap 6 utility that moves an element up and swaps its shadow on :hover and :focus-visible. Its look comes from custom properties, and .hlc-card overrides them: --bs-hover-lift-transform reads --hlc-lift, --bs-hover-lift-box-shadow sets a tinted shadow and --bs-hover-lift-transition-duration sets the speed.
The title link is a stretched-link, so the whole card is one click target and one link for screen readers. Keyboard focus lands on that inner link, not on the card, so .hlc-card:focus-within repeats the lift. The link's ::after area draws the focus outline around the full card. The arrow in .hlc-cta slides right at the same time.
.hlc-card--featured keeps the lifted state all the time and adds the "Most popular" ribbon, so one card stands out before anyone hovers.
script.js handles the filter. The radio buttons in .hlc-filter compare their value with each column's data-hlc-level, set hidden on columns that do not match, and write the result count into the .hlc-status live region.
Customization
--hlc-lifton.hlc-root: how far cards rise, for example-4pxfor a subtle effect.--hlc-ringon.hlc-root: the featured border, ribbon, focus outline and call-to-action color.--bs-hover-lift-box-shadowin.hlc-card: replace it withvar(--bs-box-shadow-lg)for Bootstrap's neutral shadow.- Move
hlc-card--featuredto another card, or remove it, to change which card stays lifted. .hlc-icon--violet,--coral,--tealand--gold: icon tile colors; add more modifiers for extra cards.data-hlc-levelon each.hlc-col: the level used by the filter; add a radio with a matchingvaluefor new levels.- Change
lg:col-3tolg:col-4for three cards per row.
Use cases
- Course sites: learning path cards rise with a soft shadow on hover and keyboard focus
- Feature sections: the whole card is clickable through a stretched link
- Pricing options: the lift effect signals which tile is about to be chosen
- Dashboards: shortcut tiles work the same way, and a level filter narrows the list
Accessibility
Each card holds one real link inside an <h3>, so the card reads as a short heading plus text instead of one long link. The focus outline wraps the whole card. The decorative arrow and icon tiles are aria-hidden. The filter is a labelled role="group" of native radio inputs, and the visually hidden .hlc-status announces how many paths are shown. Under prefers-reduced-motion the lift distance is set to none and the arrow does not animate. The shadow and border change still mark the active card.
Bootstrap 6 notes
Bootstrap 5 needed custom CSS for this effect. Bootstrap 6 ships hover-lift as a utility. Grid breakpoints use colon prefixes (md:col-6 instead of col-md-6). Toggle buttons put the input inside label.btn-check.btn-outline.theme-accent, and badges use badge badge-subtle theme-success. Built on Bootstrap 6.0.0-alpha.1, so APIs may still change.