Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CSS2] Nobody follows the spec that clearance should prevent margin collapse #8977

Closed
Loirooriol opened this issue Jun 16, 2023 · 4 comments
Closed
Labels
Closed Rejected as Invalid Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. CSS2

Comments

@Loirooriol
Copy link
Contributor

https://drafts.csswg.org/css2/#adjoining-margins

Two margins are adjoining if and only if: [...]

  • no line boxes, no clearance, no padding and no border separate them

However, Firefox, Chromium and WebKit collapse in this case:

<!DOCTYPE html>
aaaa
<div style="margin: 50px 0">
  <div style="clear: both"></div>
</div>
bbbb

Not sure if I'm missing something, but should the condition be dropped?

@bfgeek
Copy link

bfgeek commented Jun 16, 2023

I wouldn't look to this part of the spec for too much guidance for implementing margin-collapsing + floats, but this likely should say applied clearance.

@fantasai
Copy link
Collaborator

Roughly what @bfgeek said: clearance refers to the excess spacing introduced by clear in order to clear a float, not having clear set to a non-none value. See https://www.w3.org/TR/CSS2/visuren.html#clearance

I wouldn't look to this part of the spec for too much guidance

There isn't any other spec for it? We should fix any problems that actually exist here, but it's the most correct spec we have...

@fantasai
Copy link
Collaborator

Close out if you're satisfied @Loirooriol ; or reply if you think there's still something to fix.

@fantasai fantasai changed the title Nobody follows the spec that clearance should prevent margin collapse [CSS2] Nobody follows the spec that clearance should prevent margin collapse Jun 16, 2023
@Loirooriol
Copy link
Contributor Author

OK thanks, I guess this is the relevant quote:

If this hypothetical position of the element's top border edge is not past the relevant floats, then clearance is introduced

(implying that there is no clearance if there is no float or the hypothetical pos is past the floats)

@Loirooriol Loirooriol added Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. and removed Commenter Response Pending labels Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed Rejected as Invalid Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. CSS2
Projects
None yet
Development

No branches or pull requests

3 participants