Knowing how wide a text line will be in HTML for word wrap and other applications
问题 Do you know a good cross-browser way of knowing how wide will be a text line so you can break it exactly to fit a fixed width? Suppose you want to break a long text like so it doesn't overflow a fixed width container, but you want the line to break the closest to the border possible, so guessing where to insert s isn't a clean solution. I want to investigate, I imagine this could be done having an invisible div then printing the line inside it and checking the div's width, or something like