How can I determine what text on a webpage will render the largest?

Posted by TMG on Stack Overflow See other posts from Stack Overflow or by TMG
Published on 2010-04-05T21:36:12Z Indexed on 2010/04/05 21:53 UTC
Read the original article Hit count: 162

Filed under:
|
|
|
|

I'd like to write a function (ideally in PHP) where I can input a url and return a string corresponding to the hypertext from that webpage which would render the largest in a browser (any standard browser is fine).

Getting the webpage and tokenizing things with DOM is pretty straightforward, but what's the best way to calculate ultimate size of the rendered text tokens - how do you account for CSS that includes px, em, % etc. for different font sizes.

Anyone done something like this before I go and re-invent the wheel?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about css

Related posts about php