Here is my answer to the question, which I think is quite inefficient considering its length:
$('document').ready(function() {
function makeEqual(blocks,dash) {
var n =blocks;
var widthSize = dash *10;
var i=0;
var equal = "";
var contentName = "";
for(i=0;i<n;i++) {
if(i==(n-1)) {
contentName='contentL'+i;
equal = "<div id="+contentName+">"+produceDashStructure(dash*3)+"</div>";
$("#main").append(equal);
$("#"+contentName).css({marginLeft:i*widthSize , width:widthSize*3});
for(j=i;j>0;j--) {
contentName='contentR'+j;
equal = "<div id="+contentName+">"+produceDashStructure(dash)+"</div>";
$("#main").append(equal);
$("#"+contentName).css({marginLeft:((n-j)+i+2)*widthSize , width:widthSize , bottom: (((n-j)*2))*55 , position: "relative" });
}
}
else {
contentName='contentL'+i;
equal = "<div id="+contentName+">"+produceDashStructure(dash)+"</div>";
$("#main").append(equal);
$("#"+contentName).css({marginLeft:i*widthSize , width:widthSize});
}
}
}
function produceDashStructure(dash) {
var dashedStructure = "";
for(var i=0;i<dash;i++) {
dashedStructure += "- ";
}
return dashedStructure+"<br/><br/>"+dashedStructure;
}
makeEqual(5,5);
})
#main {
top: 10px;
left: 10px;
width: 30 px;
position: relative;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="main">
</div>
I have written a lot of code for a small problem which I think is time-inefficient too, and I'm using the same methodology in my projects. Any improvement in this question will help me make all my projects more efficient.