Fill viewport with squares
<p>I am trying to get the dimensions of the viewport and then fill it squares so that they perfect cover the whole viewport. There must be a better way than my current code (below). Perhaps there is a way to find an easily divisible number for the denominator of this line <code>var boxWidthHeight = wrapperArea / 30000;</code>?</p>

<pre><code>$(document).ready(function() {
    var wrapperWidth = $(window).width();
    var wrapperHeight = $(window).height();
    $('.wrapper').css('width', wrapperWidth);
    $('.wrapper').css('height', wrapperHeight);
    var wrapperArea = wrapperWidth * wrapperHeight;
    var boxWidthHeight = wrapperArea / 30000;
    var boxWidthHeight = parseInt(boxWidthHeight);
    var boxArea = boxWidthHeight * boxWidthHeight;
    var boxCount = wrapperArea / boxArea;
    for(var i = 0; i &lt; boxCount; i++) {
        $('.wrapper').append('&lt;div class="box"&gt;&lt;/div&gt;');
    }
    $(".box").css({ width: boxWidthHeight, height: boxWidthHeight });
});
</code></pre>
