Search

12/24/2007

Internet Explorer box model bug

Internet Explorer box model bug - Wikipedia, the free encyclopedia
務必記住用 YUI: YAHOO.util.Dom.getRegion 算出來的 height/width 是整個 box 的 高度/寬度, 也就是包含 padding, border 但不包含 margin

Internet Explorer versions 6 and 7 are not affected by the bug if the page contains certain HTML document type declarations. These versions maintain the buggy behavior when in quirks mode for reasons of backward compatibility.[4] For example, quirks mode is triggered:
* When the document type declaration is absent or incomplete;
* When an HTML 3 or earlier document is encountered;
* When an HTML 4.0 Transitional or Frameset document type declaration is used and a system identifier (URI) is not present;
* When an SGML comment or other unrecognized content appears before the document type declaration, or if there are errors elsewhere in the document;
* Internet Explorer 6 also uses quirks mode if there is an XML declaration prior to the document type declaration.[5]
Box model hacks have proven unreliable because they rely on bugs in browsers' CSS support that may be fixed in later versions. For this reason, some Web developers have instead recommended either avoiding specifying both width and padding for the same element or using conditional comments to work around the box model bug in older versions of Internet Explorer.[6][7]

沒有留言: