string-pixel-width icon indicating copy to clipboard operation
string-pixel-width copied to clipboard

Validate relation to font-size

Open HrFlorianHoffmann opened this issue 6 years ago • 0 comments

Could you validate that you consider the font size correctly? Plus maybe add a thought on "px" vs. "pt" vs. "em"? For example: "Provide the font size in pixels. Other units like pt, em, and rem are not supported".

Your size calculator creates a <span> element with a font-size: 100; CSS property. However, the number 100 without a unit of measure seems to be no acceptable value for the font-size property. Correct would be to provide it as 100px.

Providing the font size without unit will make the calculated size depend on a lot of things, such as surrounding HTML elements etc. In your calculator's page, ultimately the defaults hard-coded into the browser the page runs in, will apply. According to the StackOverflow response linked above, this will usually be something smaller than 100px.

HrFlorianHoffmann avatar Sep 18 '19 15:09 HrFlorianHoffmann