W3C home > Mailing lists > Public > www-style@w3.org > September 2016

Re: CSS22 don't understand box model

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 8 Sep 2016 11:04:15 -0700
Message-ID: <CAAWBYDAnYURHjN_c+j=4gBDHpLQ5qAVgdx35yGYJwsqMwXCP6w@mail.gmail.com>
To: pierre lafitte <lingtalfi@gmail.com>
Cc: www-style list <www-style@w3.org>
On Thu, Sep 1, 2016 at 1:36 PM, pierre lafitte <lingtalfi@gmail.com> wrote:
> Hi, I don’t understand this section:
>
>
> https://drafts.csswg.org/css2/box.html > 8.3.1 collapsing margins:
>
> Two margins are adjoining if and only if:
> - no line boxes, no clearance, no padding and no border separate them
> - both belong to vertically-adjacent box edges, i.e. form one of the
> following pairs:
> —— top margin of a box and top margin of its first in-flow child
>
>
> Isn’t that contradictory?
> I mean, if you have a top margin of a box and top margin of its first
> in-flow child,
> then necessarily when you go from the top margin of the box to the top
> margin of the first in-flow child you cross the
> (parent) box’s border box, as in:
>
> parent box margin
> parent box border (this is always crossed, right?)
> parent box padding
> parent box content
> child box top margin
>
>
> So isn’t that contradictory with this statement?
> - no line boxes, no clearance, no padding and no border separate them

As Oriol implied, while a border box and padding box always exist,
there's only border or padding if, well, there's actually some border
or padding.  Zero-width padding or border, or a suppressed border,
mean there is "no padding" and "no border".

~TJ
Received on Thursday, 8 September 2016 18:05:03 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:04 UTC