position:relative/absolute, containing block, hasLayout...

In all the following cases:

  1. The box with black border and grid background has position:relative, some paddings and margins. It should act as a reference for the included absolutely positioned box, being its containing block [CSS2.1 10.1]. All cases are repeated twice: before with this box having hasLayout false, and then with hasLayout true.
  2. The small box with red border has position:absolute.
  3. Sometimes the absolutely positioned box has a non-positioned parent, with some horizontal margins (inside the relative box.) This has blue border when it is a non hasLayout parent, and green border when it is a hasLayout parent
  4. The most external box (yellow border) has position:relative and hasLayout, it serves to separate the different test cases (and sometimes as a sort of reference for IE/Win when this is unable to use the correct containing block.)

ap left:0 top:0

ap
blah
blah
blah
ap
blah
blah
blah
ap
blah
blah
blah

the previous three cases, with hasLayout on the relative box

ap
blah
blah
blah
ap
blah
blah
blah
ap
blah
blah
blah

ap left:0 top:0 width:50%

ap
blah
blah
blah
ap
blah
blah
blah
ap
blah
blah
blah

the previous three cases, with hasLayout on the relative box

ap
blah
blah
blah
ap
blah
blah
blah
ap
blah
blah
blah

ap right:0 bottom:0

ap
blah
blah
blah
ap
blah
blah
blah
ap
blah
blah
blah

the previous three cases, with hasLayout on the relative box

ap
blah
blah
blah
ap
blah
blah
blah
ap
blah
blah
blah

Notes on the IE/Win behaviour:

CSS tests home