Closed alexpi closed 4 years ago
That protects a bit about rounding issues (offsetWidth
returns a rounded integer value, whereas actual character dimensions might be fractional). The code could also have used getBoundingClientRect
, which returns fractional values, but that's a bit more awkward to do for text nodes.
Hello,
In the example that fills a line with characters, why dividing 2000 by just one X doesn't work? A Math error? Did you come up with 5 by trial and error?