JSFiddle - React, Tailwind, and code Playground

by Thanos Saringelos

HTML

<div id="dpi" style="height: 1in; width: 1in; left: 100%; position: fixed; top: 100%;"></div>

JavaScript

var dpi_x = document.getElementById('dpi').offsetWidth;
var dpi_y = document.getElementById('dpi').offsetHeight;
var width = screen.width / dpi_x;
var height = screen.height / dpi_y;

alert ('your real width of your screen is : '+width*2.54 + ' cm and height : ' + height*2.54 +' cm, ('+width + ' inches and : ' + height +' inches');