Think “interaction” means “JavaScript”? Not anymore. The platform now ships powerful native features—<dialog>, the Popover API, CSS Anchor Positioning, Scroll Snap, ::target-text, :has(), light-dark(), native lazy-loading, scroll-driven animations, and more. Below is a practical, production-minded tour with tiny snippets, accessibility notes, official docs, and direct Can I Use links. I’ve also left image placeholders where you can drop support screenshots from caniuse.com.
Keep JS for data, business logic, and complex gestures. Reach for HTML/CSS first for structure and micro-interactions.
Jump to and highlight a phrase—no JS.
<a href=”#:~:text=Highlighted%20text%20goes%20here”>Jump & highlight</a>Style the highlight:
::target-text { background: mark; color: CanvasText; padding: .1em .2em; border-radius: .2em; }Docs:
MDN — Text fragments
https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Fragment/Text_fragments
MDN — ::target-text
https://developer.mozilla.org/en-US/docs/Web/CSS/::target-text
Tip: set width/height to avoid CLS; use fetchpriority=”low” for heavy media.
Docs:
MDN — Lazy loading overview: https://developer.mozilla.org/docs/Web/Performance/Lazy_loading
MDN — <img loading>: https://developer.mozilla.org/docs/Web/HTML/Element/img#loading
MDN — <iframe loading>:
You can also use scroll-padding-top on the scrolling container.
Docs:
MDN — scroll-margin:
MDN — scroll-padding:
MDN — scroll-behavior:
Docs:
MDN — content: attr(): https://developer.mozilla.org/docs/Web/CSS/content#using_a_dom_attribute_as_the_content
MDN — Pseudo-elements:
Styling & animation:
dialog::backdrop{ background: rgb(0 0 0 / .45); } @starting-style{ dialog[open]{ opacity:0; transform: translateY(24px); } } dialog[open]{ transition: opacity .2s, transform .2s; opacity:1; transform:none; }Docs:
MDN — <dialog>:
WHATWG HTML — dialog:
https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element
Essentials: [popover], popovertarget, popovertargetaction=”show|hide|toggle”. You also get ::backdrop and :popover-open.
Docs:
MDN — Popover API:
Explainer:
Docs:
MDN — CSS Anchor Positioning: https://developer.mozilla.org/docs/Web/CSS/CSS_Anchor_Positioning
Spec draft:
Docs:
MDN — Scroll Snap overview: https://developer.mozilla.org/docs/Web/CSS/CSS_scroll_snap
scroll-snap-type:
scroll-snap-align:
https://developer.mozilla.org/docs/Web/CSS/scroll-snap-align
A no-JS toggle (using :has()):
<label class=”theme-toggle”> <input type=”checkbox” id=”theme”> <span>Dark mode</span> </label> :root:has(#theme:checked){ color-scheme: dark light; }Docs:
MDN — light-dark(): https://developer.mozilla.org/docs/Web/CSS/color_value/light-dark
MDN — color-scheme:
MDN — :has():
Not every interaction warrants a framework. Browsers can do a lot already—often faster, more accessible, and easier to maintain. Experiment with these platform features and your UI will get lighter and friendlier.
.png)












