Is there any solution for displaying these kind of matrices?
If you're just displaying a bunch of boxes, what you need is a canvas.
You can draw boxes on it however you'd like. It's efficient, as there's only one DOM element.
var canvas = document.getElementById("canvas"); var ctx = canvas.getContext("2d"); ctx.fillStyle = "green"; ctx.fillRect(10, 10, 100, 100);