-
Notifications
You must be signed in to change notification settings - Fork 757
Open
Labels
Description
<!DOCTYPE html>
aaa
<canvas style="display: block; margin: 50px 0; height: 0px; min-height: 0"></canvas>
bbbNo browser lets the top and bottom margins of the replaced element to collapse through it.
The conditions are: https://drafts.csswg.org/css2/#collapsing-margins
- both belong to in-flow block-level boxes that participate in the same block formatting context
- no line boxes, no clearance, no padding and no border separate them
- top and bottom margins of a box that does not establish a new block formatting context and that has zero computed min-height, zero or auto computed height, and no in-flow children
The interior of replaced elements is outside the scope of CSS, so I guess UAs might establish an independent formatting context if they want. But probably this shouldn't be left up to the UAs, the spec should explicitly handle replaced elements.