Re: [cssom-view] Why is body's offsetParent null ?

On Wed, 23 Apr 2008 10:32:50 +0200, Daniel Glazman  
<daniel.glazman@disruptive-innovations.com> wrote:
> Anne van Kesteren wrote:
>
>> Making the HTML body element "special" helps with that. It doesn't seem  
>> very bad design either considering that the HTML body element is  
>> special in CSS and it's special with respect to event handling too.
>
> It's special wrt the 'overflow' and 'background-*' properties only as
> per CSS 2.1. So if the body element has an offset from the root element
> of the document, how are we supposed to get it ?

document.body.getBoundingClientRect().top -  
document.documentElement.getBoundingClientRect().top

or

document.body.offsetTop - document.documentElement.offsetTop


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>

Received on Wednesday, 23 April 2008 08:45:29 UTC