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

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 UTC