JSFiddle - React, Tailwind, and code Playground

by zdam

HTML

<table border="1">
<tr>
<td>Row 1, cell 1</td>
<td>Row 1, cell 2</td>
</tr>
</table>

<div id="tblHolder"></div>

CSS

.cell-style{
 
  width:150px;
  height:100px;  
}

JavaScript

var w = screen.width;
var h = screen.height;

//alert(w);
//alert(h);


var requiredWidth = 300;
var requiredHeight = 100;


var numrows = Math.floor(h / requiredHeight);
var numcols = Math.floor(w / requiredWidth);

//alert(numrows);
//alert(numcols);


var tbl = $("<table border='1'></table>");


for(var i = 0; i < numrows; i++){
 
    var row = $("<tr style='width:1920'></tr>");
    
    for(var j = 0; j < numcols; j++){
        
        row.append("<td style='width:300px;height:100px;'>"+i+","+j+"</td>");
    } 
    
    tbl.append(row);
    
}





$('#tblHolder').append(tbl);