I am facing a challenge in arranging multiple rectangular divs into a grid structure with 10 columns and 10 rows. The CSS styles for the top, bottom, left, or right positions must be in percentages to accommodate zoom in and out functionality without overlapping issues. Despite my efforts, the divs are stacking vertically instead of forming a grid layout as intended. Here is the code snippet I have been working on:
setCss = function($divId,$len) {
alert("xmlLength is :"+$len);
alert("set CSS::"+$divId);
if ($len<3)//(i%2==0)
{
var size = 10;
$("div#"+$divId).css("top",size*$len+"%");
$("div#"+$divId).css("left",size*$len+"%");
$("div#"+$divId).css("transform","none");
$("div#"+$divId).css("margin","10px");
}
if (i>=3 )
{
var size = 10;
$("div#"+$divId).css("top",size*$len+"%");
$("div#"+$divId).css("left",size*$len+"%");
$("div#"+$divId).css("bottom",size*$len+"%");
$("div#"+$divId).css("right",size*$len+"%");
$("div#"+$divId).css("transform","none");
$("div#"+$divId).css("margin","10px");
}
};
I have experimented with various combinations but have not achieved the desired result yet. Any guidance on how to tackle this issue would be greatly appreciated. Thank you!