If Container Width, Padding And Line-height Is Known, How To Calculate Height?
I am adding element dynamically to DOM. $('').text(data.status).appendTo(app.twitter_feed); I want to get element height before it is added to
Solution 1:
How the content wraps inside a container may depend on browser and zoom level, so unless you're very sure the content will never wrap, I would advise determining the height the way you have described.
Solution 2:
If your text font is mono-sized-font, yes you can calculate it with formula [(text-length/(width/char-width))]
, but I'm sure you are not using mono-sized-font like courier, monospace etc.
Answer is this : there is no way to do this with multi-sized-fonts, me sorry.
Post a Comment for "If Container Width, Padding And Line-height Is Known, How To Calculate Height?"