Your question is very vague.
What technologies are you willing ( or able in the case of homework like project) to use to achieve your goal?
If you have no idea how to do it then i would suggest you start learning of some jQuery, that is a javascript framework, that allows you to do some pretty cooll and easy stuff.
If you do end up using jquery, all you would have to do is to create an element lets say:
<div id="container"></div>
and then somewhere in your javascsript you would have a javascript array with the objects that you are rendering for, say an object named square { color,title,text,name,this,that }
And after that you could just create a loop,construct your html elements as string and use jquery to append the elements in your DOM.
An example would be :
var myContainer = $('#container'); <--- this holds a reference to the container element using jquery
for(var i=0,len=myArray.length;i<length;i++){ <-- in my array you would have your "square" objects so that you can modify each square based on parameters like name,title,color etc
var elementInString = '<div class="square" style="color:"'+myArra[i].color+'>'; <-- and create your parameterised square here
$(myContainer).append(elementInString);
}
This is one way to do it. Other way include using other frameworks (Knockout,Angular etc)
I hope this helps