Present day CSS now has @container queries support for sizing and soon also design & state, Which mainly implies a native way for an if/else condition. Below is a very simplified case in point. It offers a good suggestion of how gecko, webkit along with other main rendering engines developed https://www.presta-addons-modules.com/en/seo/prestashop-seo-automatic-open-graph-twitter-cards-tags-on-all-pages.html