javascript – css media queries или js?


ie 8 doesn't understand css media queries.

I found a script that solves this problem, only this script is quite voluminous.

Why can't you just check the body size via js and, depending on the size, include styles?

Why isn't this approach used?

What are its disadvantages?


The difference is in the time you spend debugging. If you made a mistake using CSS, the IDE will show you right away. And in the case of JavaScript, after each edit, you need to at least reload the page.

Scroll to Top