JSFiddle - React, Tailwind, and code Playground
by BaliBalo
CSS
html, body
{
margin: 0;
height: 100%;
}
#field
{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
/*(IE fallback)*/
width: 100vm;
height: 100vm;
/*You can change the size of the field here*/
width: 100vmin;
height: 100vmin;
/*Prevent white-spaces to be inserted*/
font-size: 0;
}
#field > div
{
/*Reset font-size*/
font-size: 1rem;
text-align: center;
vertical-align: middle;
overflow: hidden;
white-space: nowrap;
display: inline-block;
width: 10%;
height: 10%;
/*Allows to use borders*/
box-sizing: border-box;
border: 1px solid #000;
}
/* Trick for vertical centering */
#field > div:before
{
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
}
JavaScript
var field = document.createElement('div');
field.id = 'field';
for(var i = 0; i < 100; i++)
field.appendChild(document.createElement('div')).textContent = i;
document.body.appendChild(field);