0

I am trying to calculate the height of each letters and show the height of the each letter. For example, height of letter 'H' is different than the height of 'e'.

I am getting the value from an input box with the event listener.

inputText.addEventListener('input', (e)=>{....})

I have tried,

let display = document.querySelector('display');

getComputedStyle(display).height;

display.getBoundingClientRect();

With these I am only able to get the height of the content box, not the height of the letters. How could I get the height of the letters? Not from a canvas but direct HTML element.

Mark Rotteveel
  • 90,369
  • 161
  • 124
  • 175
  • 1
    Does this answer your question? [Calculate exact character\string height in javascript](https://stackoverflow.com/questions/16816071/calculate-exact-character-string-height-in-javascript) – zbee Apr 06 '22 at 14:56

0 Answers0