javascript - Fill Screen with multiple DIVs -


Status: I'm currently working on a website design for which I want to fill Required screen with 60px x 60px DIV. They are just like tiles on a wall, except that there are plenty of them, because each has to change its color so that they can convert to the pavilion at a random value.

Problem: If the monitor resolution changes, the number of DIVs changes. I realize that I need to lay eggs to those tiled DIVs in relation to the screen size .

Question: How can this be done?

I would recommend a solution witout javascript. Overflow is a container hidden inside the square divs with the left, so that they fill:

  & style; Style = "text / css" & gt; . Container {Overflow: Hidden; Height: whatever you want width: whatever you want}. Container .square {float: left; Width: 60px; Height: 60px; Display area; } & Lt; / Style & gt; & Lt; Div class = "container" & gt; & Lt; Div class = "square" & gt; & Lt; / Div & gt; & Lt; Div class = "square" & gt; & Lt; / Div & gt; & Lt; Div class = "square" & gt; & Lt; / Div & gt; & Lt; Div class = "square" & gt; & Lt; / Div & gt; ... enough of this ... ... & lt; / Div & gt;  

Of course you can use javascript. I recommend using a library such as prototype or jquery and will handle onload and onrece events. Then you can calculate how many divs you need from the screen width and height, it will probably be something like (width / 60) * (height / 60) or something else ....


Comments