As yet unproposed, the Element Queries CSS module allows developers to style elements based on their size and shape.
This repository catalogs Element Query implementations realized through JavaScript.
Element Queries are the natural and much-needed evolution of Media Queries. Where Media Queries cared about the size of the screen, Element Queries care about the size of the thing. As a result, Element Queries allow content to adapt to a wide range of viewing experiences without having to change the content itself. They also simplify stylesheets by removing the need to specify layout conditions between the screen and the element being styled.
The simpliest use case is: “I have a widget that needs to look good in any column of our layout, whether that column is small, medium, or large.”
Use cases are more fully documented in the Use Cases and Requirements for Element Queries Editor’s Draft.