Skip to content

[css-sizing] Golden Ratio keyword in 'aspect-ratio' #5320

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

Closed
Crissov opened this issue Jul 14, 2020 · 3 comments
Closed

[css-sizing] Golden Ratio keyword in 'aspect-ratio' #5320

Crissov opened this issue Jul 14, 2020 · 3 comments

Comments

@Crissov
Copy link
Contributor

Crissov commented Jul 14, 2020

Since <ratio> includes <number> now #3757, authors can use irrational values in 'aspect-ratio', e. g. calc((1 + sqrt(5)) / 2) yielding the Golden Ratio of c. 1.618. If phi was not accepted to be added as a predefined numeric constant #4702, it would be convenient to have it available as a classic keyword, e.g. golden or golden-ratio, in this property for the reasons provided in that issue already.

@danburzo
Copy link

I think in this case, the modicum of convenience doesn't justify the introduction of a (single) keyword in the aspect-ratio syntax, given that <number> covers that pretty well with a --phi custom property. While it has had an enduring appeal throughout the ages, it's just one of the many common aspect ratios. Beyond convenience, a keyword signals endorsement.

@Crissov
Copy link
Contributor Author

Crissov commented Jul 14, 2020

Iʼd be the last person to oppose additional useful keywords, but most common ones are easily and correctly represented by a decimal floating point number or a vulgar fraction as supported.

I already explained why variables make no sense for universally understood constants and that the Golden ratio is slightly more complex than, say, sqrt(2), both in #4702.

@tabatkins
Copy link
Member

For the same reasons as stated in previous threads, I oppose adding this for now. The precise value of the golden ratio has no specific meaning or significance in layouts; in practice it's actually just "rectangles that are approximately 3:2 usually look pretty good". At absolute most, specifying a ratio of 1.6 / 1 adequately addresses this, and asking authors to write their values with that degree of precision is completely reasonable.

If there are ever reasons why authors do need the precise value of the golden ratio, and it's believably common enough to be worth the (relatively small) spec/implementation/testing burden, we can consider adding it. But no such reason has been presented yet, so I'm going to close this issue.

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

No branches or pull requests

4 participants