Is it possible to set an element's height using CSS to match the window inner height without directly modifying its style with JavaScript? Can this be achieved by changing a CSS class with JavaScript?
One attempted solution involved:
document.getElementById('root').style.setProperty('--view-height', window.innerHeight +'px');
And in CSS:
.menu {
height: var(--view-height) !important;
}
While this approach worked, it relied on CSS Variables which may not be supported in older browsers. Is there an alternative method that can achieve similar results?
EDIT: Several responses have suggested JavaScript solutions, but I specifically need to avoid altering the element's style directly with JavaScript. The goal is to accomplish this solely through CSS class styling.