JSFiddle - React, Tailwind, and code Playground

by daneren2005

JavaScript

[1, 1.2, 1.4, 1.6, 2, 3].forEach(function(size) {
  var text = $('<div>').text('Type here')[0];
  $(text).css('font-size', 20 * size);
  
  $('body').append(text);
  
  var rect = text.getBoundingClientRect();
  var realWidth = rect.width / size;
  var realHeight = rect.height / size;
  
  $(text).text(size + ': ' + realWidth + ' x ' + realHeight);
});