This is a very simple one which I have never ran into before.
Depending on the context of the page, if the app is running directly, it should take the browser window height but otherwise it should be auto
.
Just imagine for now that I don't have 2 context. Just 1. Direct. In that case, this following CSS would do what I want.
html, body {
height: 100%
}
So perhaps, lets take it further, and make it a class so we can go back to the optional support of both contexts.
.fit {
height: 100%
}
I am aware I could do element.classlist.add('fit')
on elements including the document.body
. However for the life of me, I cannot figure out how to do that with the window
which I presume html{}
rule refers to.
How do I set a class (or a direct style) dynamically in this instance?