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.
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.