W3C home > Mailing lists > Public > www-style@w3.org > April 2008

Re: [cssom-view] padding edge / border edge for offsetTop/offsetLeft?

From: Alan Gresley <alan@css-class.com>
Date: Thu, 24 Apr 2008 23:55:36 +1000
Message-ID: <48109158.90305@css-class.com>
To: Anne van Kesteren <annevk@opera.com>
CC: Mike Wilson <mikewse@hotmail.com>, 'Sylvain Galineau' <sylvaing@microsoft.com>, 'Www-style' <www-style@w3.org>

Anne van Kesteren wrote:

> On Thu, 24 Apr 2008 01:23:05 +0200, Mike Wilson <mikewse@hotmail.com> 

>> Yes, IE includes the border for element traversals up to its
>> offsetParent but not the border of the offsetParent itself.
> 
> Actually, that depends.
> 
> Compare the offsetTop/offsetLeft of #x from
> 
> <!doctype html>
> <style>
>  body { margin:0 }
>  div { border:10px solid; height:100px; width:100px }
>  div#x { border:20px solid orange; height:10px; width:20px }
> </style>
> <div><div id=x></div></div>
> 
> with
> 
> <!doctype html>
> <style>
>  body { margin:0 }
>  div { border:10px solid  }
>  div#x { border:20px solid orange; height:10px; width:20px }
> </style>
> <div><div id=x></div></div>
> 
> in Internet Explorer.
> 
> Since Firefox and Opera always are relative against the border box I 
> think reverting this was a mistake. This is exactly the hasLayout 
> dependency I was trying to avoid.
> 
> Or am I missing something?


I don't know (you confusing me :-). Which IE are you talking about? IE7 
will offset div#x relative to the content/padding box since it's parent 
has a height triggering hasLayout. How does IE8 offset div#x?

This is why myself and possibly Mike have both asked you why you keep on 
mentioning hasLayout. Do you understand why hasLayout has this affect?

Why not just offset against the border box?


Alan
Received on Thursday, 24 April 2008 13:56:35 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:05 GMT