Container queries are handled by the browser, so Mendix is probably not to blame.
You can develop a pluggable widget with a client canvas that calls a micro/nanoflow after rendering to toggle a boolean that is used in conditional visibility.
BTW a class has no width, you probably mean an element node in the DOM (something possibly visible on screen).