HTML how to automate the creation of/programmatically create divs?
Posted
by
bernlim
on Stack Overflow
See other posts from Stack Overflow
or by bernlim
Published on 2012-09-21T03:34:52Z
Indexed on
2012/09/21
3:37 UTC
Read the original article
Hit count: 127
I have a div grid like this:
<div id="MainDiv" style="border:1px solid black; width:162px; height:160px;">
<div id="Column1" style="float:left">
<div id="sq1" style="width:40px; height:40px;">
</div>
<div id="sq2" style="width:40px; height:40px;">
</div>
<div id="sq3" style="width:40px; height:40px;">
</div>
<div id="sq4" style="width:40px; height:40px;">
</div>
</div>
<div id="Column2" style="float:left">
<div id="sq5" style="width:40px; height:40px;">
</div>
<div id="sq6" style="width:40px; height:40px;">
</div>
<div id="sq7" style="width:40px; height:40px;">
</div>
<div id="sq8" style="width:40px; height:40px;">
</div>
</div>
<div id="Column3" style="float:left">
<div id="sq9" style="width:40px; height:40px;">
</div>
<div id="sq10" style="width:40px; height:40px;">
</div>
<div id="sq11" style="width:40px; height:40px;">
</div>
<div id="sq12" style="width:40px; height:40px;">
</div>
</div>
How do I write just a few lines of code to automate the entire process?
© Stack Overflow or respective owner