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

[css-sizing] Nobody follows the spec about cyclic percentages in preferred&max sizing properties of replaced element #11452

Open
Loirooriol opened this issue Jan 7, 2025 · 0 comments
Labels

Comments

@Loirooriol
Copy link
Contributor

https://drafts.csswg.org/css-sizing-3/#replaced-percentage-min-contribution

If the box is replaced, a cyclic percentage in the value of any max size property or preferred size property (width/max-width/height/max-height), is resolved against zero when calculating the min-content contribution in the corresponding axis.

For starters, this needs to then floor the max-content contribution by that amount, otherwise the min-content contribution could be larger:

<canvas width="50" height="50" style="width: calc(100px + 0%)"></canvas>
  • Min-content contribution: 100px + 0px = 100px
  • Max-content contribution: 50px

But browsers don't have this problem, because they do not resolve percentages against zero. Instead, they treat the min-content contribution as zero:

<!DOCTYPE html>
<div style="width: min-content; border: solid">
  <canvas width="50" height="50" style="width: calc(100px + 0%)"></canvas>
</div>

This is in fact analogous to #10969

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant