c# - Calculate area of HTML element on website? -
i'm trying figure out if it's possible calculate area of html element on website? in pixels, percentage or whatever.
my first thoughts have been make assumption element 100% in width , height, , try retrieve size through mapping between html , css.
so if there's width/height attribute in referenced css-file possibly body element covered column takes 25% of area (everything based on screen resolution of course - , i'm still trying figure out how i'd able programmatically).
or whether should render website , calculations based on image common screen resolution @ time).
are there more possible solutions?
(currently i'm trying solve in perl, suppose language that's got library purpose appreciated know about!)
edit: need retrieve visual area every single element on page. example; if there elements on top of <body> element, covers visually, want exclude area <body>'s , on. simple raytracing find visible area every element on page.
edit: let's exclude javascript - other approaches possible?
personally, use jquery - if don't use library, best bet javascript solution.
var $elt = $('#some-element-id'), height = $elt.height(), width = $elt.width(), area = height * width; // contains area in px^2
Comments
Post a Comment