"Frustrated by the many limitations and CSS compatibility issues, and I constantly need to write javascript code to get my web pages in the layout as I wanted," suggests that you either used CSS incorrectly or didn’t actually set enough time, studying all the CSS inputs and outputs to get it to do what you want (setting up good, universal CSS is hard, just like JS programming), and there are a million ways to do it wrong - just like JS programming) .
Your example seems to work on a 100% height page. This is actually relatively easy if you set html and body to a height: for example, 100%. Once you do this, h / valigning boxes becomes very easy.
Then, answering your question: doing your whole style using JS calls will be much more expensive than using CSS, so I strongly suspect your solution will be much worse than good CSS or CSS + JS. Browsers have extremely optimized code for performing calculations using CSS triggers, and the same thing in JavaScript is several times slower. Using JS for a specific style, because CSS does not have a function, for example, field alignment, as your example, is usually a necessity, but every time you run it, it will have to re-run the full algorithm in JS code, and not use its own The compiler has much faster plugin libraries that may be available for some or all of the models you want to achieve.
Mike 'Pomax' Kamermans
source share