I want to have a element on my website that I would like to be 100% height and width of the window, even after resizing. Width is easy:
#myElement {
width: 100%
}
But the height can cause some issues. In my head, this makes sense:
window.onresize = function () {
document.getElementById("myElement").style.height = window.innerHeight;
}
Is wrong with my logic here? Because this doesn’t always work as planned. Lets assume it’s not IE since (I don’t think) they support window.innerHeight.
You can achieve this with CSS, no javascript required.
And the mark up:
Example here: http://jsfiddle.net/CTGaP/