Re: Inconsistent position:relative behaviour

On 13/02/2011 5:05 AM, Markus Ernst wrote:

> It is this sentence then:
>
> "The top margin of an in-flow block box is adjoining to its first
> in-flow block-level child's top margin if the element has no top
> border, no top padding, and the child has no clearance."
>
> I must admit I was not aware of what this means before. Is there any
> use case that makes margin collapsing between parent and child
> elements desirable?


Yes. When an element is not in normal flow and many more other cases 
that I could take weeks to articulate.


<http://css-class.com/test/bugs/ie/floatsandblockelements.htm>

<http://css-class.com/test/css/visformatting/ap-collapsing-margins.htm>


> I'd actually suggest to drop this. Making a margin of a child element
> affect the behaviour of the parent looks highly counterintuitive to
> me.


If this behavior was dropped, the web would be broken.


> My use case is a very common task: A footer that sticks at the
> viewport bottom if there's enough space, but always remains below the
> content area if there is more content. I set up a test page that
> illustrates how I'd expect to code this:
> http://www.markusernst.ch/stuff_for_the_world/css-position-test2.html


Add this.

#main { overflow: auto; padding-bottom: 1em; }


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

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

Received on Saturday, 12 February 2011 19:28:37 UTC