enigma1 - 6:29 pm on Oct 2, 2010 (gmt 0)
First fix your margins. margin-top and margin-left need units.
If you want them to be stacked you may need to put the absolute property to the inner div and then the margin offsets are subject to its parent div.
Randomize them based on the square area keeping track of the populated areas.