The problem⌗

Currently we have media queries, but in most cases widgets have not the full width of the viewport.

Partial solutions⌗

Flexbox and grid layouts support some kind of inner responsiveness.

ResizeObserver to the rescue⌗

For more complex scenarios we have to use JavaScript currently. There are a lot of container query libraries, most of them overcomplicated to my taste. (One of the reasons why it is not yet in CSS.)


Update - container queries have been arrived meanwhile!