JSFiddle - React, Tailwind, and code Playground
CSS
.gridlines { display: none; position:absolute; background-color:#ccc; }
JavaScript
function createGrid(size) {
var i,
height = $(window).height(),
width = $(window).width(),
ratioW = Math.floor(width/size),
ratioH = Math.floor(height/size);
for (i=0; i<= ratioW; i++) // vertical grid lines
$('<div />').css({
'top': 1,
'left': i * size,
'width': 1,
'height': height })
.addClass('gridlines')
.appendTo('body');
for (i=0; i<= ratioH; i++) // horizontal grid lines
$('<div />').css({
'top': 1 + i * size,
'left': 0,
'width': width,
'height': 1 })
.addClass('gridlines')
.appendTo('body');
$('.gridlines').show();
}
createGrid(50);