Re: Inconsistent position:relative behaviour

On 13/02/2011 12:17 AM, Markus Ernst wrote:
[snip]
> Please view the test case I made:
> http://www.markusernst.ch/stuff_for_the_world/css-position-test.html
>
> Is this a bug? Then I'd suggest to discuss a way how to get rid of it
> without breaking legacy content that might rely on it.


What you are seeing is normal margin collapsing [1].

   | Two or more adjoining vertical margins of block-level
   | boxes in the normal flow collapse.


> Or is there some sensible reason for this behavior? Then I'd suggest
> to add a possibility to allow margins for children of elements with
> position:relative without affecting the positioning reference and
> background of the container.


You can either give the container a border (which you have in the third 
example), padding or give a property and value that establishes a block 
formatting context [2].


1. <http://www.w3.org/TR/CSS21/box.html#collapsing-margins>
2. <http://www.w3.org/TR/CSS21/visuren.html#block-formatting>


-- 
Alan http://css-class.com/

Armies Cannot Stop An Idea Whose Time Has Come. - Victor Hugo

Received on Saturday, 12 February 2011 15:16:34 UTC