Is it possible to create a division that covers the total width and height of the screen using just CSS without relying on JavaScript or jQuery?
<div id="all"></div>
I have tried setting the width and height of the element to 100%, but I am starting to think that CSS cannot accurately calculate the window size if the document does not occupy the entire space. Is my theory correct?
If so, could setting the body height to 100% by default solve this issue? Like this:
body{
height:100%
}
I know how to achieve this with JavaScript or jQuery:
$(document).ready(function(){
$('#div').css({
height:$(window).height(),
width:$(window).width()
});
});
However, I am trying to explore whether there is a pure CSS solution for this problem. Any insights would be appreciated. Thank you.