Getting started
No JavaScript
How every Bootstrap plugin is replaced by native HTML and progressively enhanced CSS.
The rule
Every interactive component has a baseline that works with nothing but HTML and
widely-supported CSS, and one or more enhancements that newer engines pick up through
@supports. Nothing requires a script, and nothing breaks when an enhancement is missing — it
just looks a little plainer.
Four native mechanisms do almost all of the work:
<details>/<summary>— toggling (collapse, accordion, dropdown).- The Popover API — top-layer overlays with light-dismiss and Escape (modal, offcanvas, popover, toast, dropdown).
<dialog>+<form method="dialog">— dismissal (alerts, modal close buttons).:has(), radios and:target— state without a class toggle (tabs, navbar collapse, fallbacks).
Component matrix
| Bootstrap plugin | Baseline mechanism | Enhancement | Page |
|---|---|---|---|
| Collapse | <details class="collapse"> | Animated height via ::details-content + interpolate-size | Collapse |
| Accordion | <details name="…"> (exclusive groups are native) | Same height animation | Accordion |
| Dropdown | <details class="dropdown"> | popover menu + anchor positioning (light-dismiss) | Dropdowns |
| Navbar collapse | Checkbox + :has() | — | Navbar |
| Tabs / pills | Radio inputs, panes paired by index | — | Navs & tabs |
| Modal | <dialog popover> + popovertarget; :target fallback | command="show-modal" for true modality; @starting-style fade | Modal |
| Offcanvas | popover + popovertarget; :target fallback | Slide transition via @starting-style | Offcanvas |
| Alert dismiss | <dialog open> + <form method="dialog"> | — | Alerts |
| Toast | popover="manual" + popovertargetaction="show" | Fade in, CSS auto-hide | Toasts |
| Tooltip | data-bs-title rendered by attr() on hover/focus | Anchor positioning escapes overflow clipping | Tooltips |
| Popover | popover element, invoker is the implicit anchor | Anchor positioning with flip fallbacks; centered otherwise | Popovers |
| Carousel | Scroll-snap track + anchor-link indicators | ::scroll-button() / ::scroll-marker; view-timeline fade | Carousel |
| Scrollspy | Plain anchor nav | Scroll-driven animation with timeline-scope | Scrollspy |
| Button toggle | .btn-check (already CSS in Bootstrap) | — | Buttons |
| Form validation | :user-invalid / :user-valid | — | Validation |
The Popover API in one minute
Any element with a popover attribute is hidden until shown, then rendered in the browser's
top layer above everything else. A <button popovertarget="id"> toggles it;
popovertargetaction="show" or "hide" makes the button one-way.
popover(auto) — clicking outside or pressing Escape closes it. Modals, offcanvas, dropdowns, popovers.popover="manual"— stays until a button hides it. Toasts.::backdropstyles the dimmer behind it.autofocuson an element inside moves keyboard focus when it opens.
HTML
<button class="btn btn-primary" popovertarget="pop-demo">Toggle</button>
<div class="popover" popover id="pop-demo" data-bs-placement="bottom">
<div class="popover-arrow"></div>
<div class="popover-header">Top layer</div>
<div class="popover-body">Click outside or press Escape to close.</div>
</div>Enhancement features used
| Feature | Used by | Without it |
|---|---|---|
CSS anchor positioning (position-area) | Dropdown popovers, popovers, tooltips | Dropdown becomes a bottom sheet; popover centers in the viewport; tooltips stay absolutely positioned |
@starting-style + transition-behavior: allow-discrete | Modal, offcanvas, toast, popover fades | Instant show/hide |
::details-content + interpolate-size | Collapse, accordion | Instant open/close |
::scroll-button(), ::scroll-marker | Carousel | Hand-written indicator links; swipe or scroll |
Scroll-driven animations (view(), timeline-scope) | Carousel fade, scrollspy | No crossfade; nav link is not highlighted |
Invoker commands (command="show-modal") | Modal | Popover modal (no inert background) |
What you lose without a script
Be honest about the trade. These are the behaviours that have no CSS equivalent:
- A toast that appears on its own after an event. Toasts open from a button.
- A carousel that auto-advances. Ours waits for the user.
- Closing a
<details>dropdown by clicking elsewhere. Use thepopovervariant for light-dismiss. - Scrollspy in engines without scroll-driven animations.
- Opening a modal, offcanvas or toast from anything other than a button or link.
Everything else — keyboard access, focus rings, Escape to close, reduced-motion — is handled natively.
Legacy Bootstrap markup
Static classes still work: .collapse.show, .tab-pane.active,
.toast.show, .navbar-collapse.show, .dropdown-menu.show all render as
before. data-bs-toggle attributes are inert except data-bs-toggle="tooltip", which
the CSS reads. .fade no longer hides an element; it only opts into the fade transition.