I'm trying to figure out how I can have a font size that is always exactly 7 pixels wide and 15 high in all letters / charateres.
I thought font-family: consolas;
with font-size: 12.73px;
was perfect but after testing more accurately (by calculating the size of 100 characters) I discovered the following:
function Atualizar(){
document.getElementById('Font').style.fontSize = document.getElementById('Input').value + "px";
document.getElementById('Horizontal').innerHTML = document.getElementById('Font').getBoundingClientRect().width;
document.getElementById('Vertical').innerHTML = document.getElementById('Font').getBoundingClientRect().height;
}
Atualizar()
span {
font-family: consolas;
}
<span id="Font">1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890</span>
<br>
<br>
<span>Tamanho da font: </span><input id="Input" oninput="Atualizar()" value="12.739999294281004971196">
<br>
<span>Largura de 100 caratere: </span><span id="Horizontal"></span>
<br>
<span>Altura de 1 carateres: </span><span id="Vertical"></span>
Note: after writing, reading and listening to both English online, I no longer have an idea if I write in English character, character, character, characters, characters, etc. I'm reading caratere and characters (lyrics).