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

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

From: Anne van Kesteren <annevk@opera.com>
Date: Thu, 24 Apr 2008 11:45:07 +0200
To: "Mike Wilson" <mikewse@hotmail.com>, "'Sylvain Galineau'" <sylvaing@microsoft.com>
Cc: "'Www-style'" <www-style@w3.org>
Message-ID: <op.t93z1hp164w2qv@annevk-t60.oslo.opera.com>

On Thu, 24 Apr 2008 01:23:05 +0200, Mike Wilson <mikewse@hotmail.com>  
wrote:
>> Yes, they may be assuming that offsetLeft/Top includes the
>> border; which is true for IE and Opera
>
> 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?


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Received on Thursday, 24 April 2008 09:45:21 GMT

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