Fill container with tile image using javascript

Viewed 33

I have this container div that i need to fill with tiles of smaller divs, using a loop in javascript. Id should, no matter of the amount of tiles cover the whole with and height of the container. How would you do this?

html

<div class="container"></div>

css

.container {
    width:100%;
    height:100%;
    position: fixed;
    bottom: 0;
    left: 0;
}

js

var tilesLimit = 20; //could as well be 30, 14 or whatever  
for (var i = 0; i < tilesLimit; i++) {
    //create and position tiles
}
0 Answers
Related