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

Mention how <ratio> values are compared #37482

Open
getdagnis opened this issue Jan 3, 2025 · 2 comments · May be fixed by #37509
Open

Mention how <ratio> values are compared #37482

getdagnis opened this issue Jan 3, 2025 · 2 comments · May be fixed by #37509
Labels
Content:CSS Cascading Style Sheets docs goal: clarity (Experimental label) Issues about unclear/confusing/inconcise content.

Comments

@getdagnis
Copy link

MDN URL

https://developer.mozilla.org/en-US/docs/Web/CSS/@media/aspect-ratio

What specific section or headline is this issue about?

No response

What information was incorrect, unhelpful, or incomplete?

The max-aspect-ratio media feature can be a bit counterintuitive. It's not clear how aspect ratio works.

What did you expect to see?

In this case, max-aspect-ratio actually means "maximum width-to-height ratio". So, if you set max-aspect-ratio: 16/9, it means the device's width-to-height ratio should be 16:9 or less, i.e., 16:16 is less rather than more.

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

MDN metadata

Page report details
@getdagnis getdagnis added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jan 3, 2025
@github-actions github-actions bot added the Content:CSS Cascading Style Sheets docs label Jan 3, 2025
@OnkarRuikar
Copy link
Contributor

An aspect ratio is the proportional relationship between width and height: width / height. So, increasing height decreases the aspect ratio. This has been covered in the aspect ratio glossary page.
Here 16/9 = 1.7777777778 and 16/16 = 1. So 16/9 > 16/16.

If you find max-aspect-ratio: 16/9 confusing, you can use max-aspect-ratio: 1.78 alternatively.

@Josh-Cena
Copy link
Member

We can add this to the <ratio> type saying that they are compared by the quotient's numeric value. See spec:

If two <ratio>s need to be compared, divide the first number by the second, and compare the results. For example, 3/2 is less than 2/1, because it resolves to 1.5 while the second resolves to 2. (In other words, “tall” aspect ratios are less than “wide” aspect ratios.)

@Josh-Cena Josh-Cena removed the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jan 6, 2025
@Josh-Cena Josh-Cena changed the title Missing information Mention how <ratio> values are compared Jan 6, 2025
@OnkarRuikar OnkarRuikar linked a pull request Jan 6, 2025 that will close this issue
@caugner caugner added the goal: clarity (Experimental label) Issues about unclear/confusing/inconcise content. label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:CSS Cascading Style Sheets docs goal: clarity (Experimental label) Issues about unclear/confusing/inconcise content.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants