w3c / w3c/csswg-drafts

[CSS2] Current definition of margin collapsing isn't interoperable.

Open
#5,571 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

CSS2
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

https://www.w3.org/TR/CSS2/box.html#collapsing-margins

This is somewhat a meta issue which was found while investigating behaviour for aspect-ratio. We (Blink) haven't had any reports of users hitting these inconsistencies between implementations so this is largely an "academic" issue and not immediately important.

While investigating I created this testcase:
https://www.software.hixie.ch/utilities/js/live-dom-viewer/?saved=8342

The inconsistencies are around collapsing through margins, and when things are considered adjoining. Some implementations will "double-count" a margin in certain cases (which seems bad).

This indicates that the current definition isn't sufficient (or consistent) for building an interoperable implementation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CSS2 box model section on collapsing margins and reproduce the behavior using the linked live DOM viewer testcase. Compare how implementations handle collapsing through margins, adjoining margins, and possible double-counting. Done means producing a clarified definition that implementations can apply consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
frontend, web-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.