W3C home > Mailing lists > Public > www-style@w3.org > February 2011

Re: Inconsistent position:relative behaviour

From: Alan Gresley <alan@css-class.com>
Date: Sun, 13 Feb 2011 02:15:57 +1100
Message-ID: <4D56A42D.2060300@css-class.com>
To: Markus Ernst <derernst@gmx.ch>
CC: www-style list <www-style@w3.org>
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:37 GMT