Tables and absolutely positioned elements

Bug: When placing an absolutely positioned element inside a table with an undefined (and hence static) position, Explorer always reacts as if the table has a position: relative. Its coordinates are relative to the upper left corner of the table, not the upper left corner of the page. Even explicitly giving the table a position: static doesn't help.

Example: In the screenshots below, the container element is a table, and a testdiv element is inside one of the <TD>s.

The <DIV> appears flush against the right border. Since there is no other content on the page, no scrollbars are necessary. Mozilla positions it correctly:

Explorer also gets it right, but then generates an unnecessary right page margin, causing an unwanted horizontal scrollbar:

The problem is an extra 15px right margin of the <DIV>, which is exactly the space a scrollbar takes up. Still, it's not easy to understand which scrollbar should be placed in this margin. The relation (if any) of this bug to incorrect treatment of scrollbar space is not clear.

Workaround: Give the element a right of 15px and a negative right
margin of 15 pixels:

The other browsers react in the same way as Explorer, so this workaround gives few cross-browser compatibility problems (except for Mozilla on Windows 2000, which may sometimes show a slight margin of 1px).

The same bug can appear when positioning an element at the bottom of the browser window. In
that case, margin-bottom should be set to -15px.