Perfect overlap of HTML element?

dmnc

New Member
Is it possible to write a javascript function that given any HTML element (visible on the screen) it creates another HTML Element to stack above it (so to cover it !!!)and then if I resize the page it moves exactly as the component it covers.(so for instance if I were using getBoundingClientRect it would not work if the original component has the width expressed in percentage) The function should handle any case whether the div has margins,paddings, borders,... whether its display is block or inline... More:I tried by adding a position:relative to the parent-component and then create a position:absolute on the "cover" component. This did not work... because it does not handle cases like padding or margins...
 
Back
Top