๐ŸŽฎ ResizeObserver โ€” watch the element, not the window

Drag the box's bottom-right corner, or move the slider โ€” either way a ResizeObserver reports the box's own size live, and the layout inside reacts to its width, not your browser window's.

1 Resize the box
๐Ÿ“„ Card A
๐Ÿ“„ Card B
๐Ÿ“„ Card C
โณ measuringโ€ฆ
Width โ€” 340px

The corner-drag is mouse/touch only โ€” the slider is the accessible equivalent, and both do the exact same thing: change the element's own box. Watch the cards inside flip from stacked to side-by-side once the box gets wide enough โ€” that's an element-driven breakpoint, the same trick behind CSS container queries, done in JavaScript.

2 Live ResizeObserver readout
callback fired: 0ร— window "resize" events: 0ร—
// resize the box above โ€” the entry appears here

contentRect, contentBoxSize, and borderBoxSize are the three ways one ResizeObserverEntry reports the new size. Drag or slide the box and this updates instantly; resize your actual browser window instead and it doesn't move โ€” only the "window resize events" counter above does. That's the whole point: the observer reacts to the element, independent of the window.

3 Entry log

Every batch the browser delivers, newest first.

Observingโ€ฆ the box's starting size will appear here in a moment.