getting pixel length of text
Are there any methods that I can use to get the pixel length of a text element? The text element would change pixel length depending on its font.
To the best of my knowledge no. You can get the length the container it's in if that is any use to you, I'm not sure the information you've given.
Great wit and madness are near allied, and fine a line their bounds divide.
A span element with no padding should have the same length as the text which it contains.
I used Span.
Just had to set:
.style.whiteSpace = "nowrap";
and then use the .offsetWidth property to get the width.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)