I want to achieve a layout where the outer div is 100% width and height. In this div I will add more divs dynamically. I want to write a css structure that splits the outer div so that each div gets the same space. Actually I want to create a dynamic grid with div elements.
Examples below:

I want to achieve a layout where the outer div is 100% width and
Share
The answer of “Sowmia” is so good but one thing :
you want to sub div have AUTO SIZE and with is solution you can’t do this.
my solution is exactly the Sowmia’s answer with some changes:
and html:
and this is :
DEMO