-
Notifications
You must be signed in to change notification settings - Fork 22.5k
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
fix(css): explain CSS aspect ratio comparison #37509
base: main
Are you sure you want to change the base?
Conversation
OnkarRuikar
commented
Jan 6, 2025
- fix Mention how <ratio> values are compared #37482
Preview URLs Flaws (96)Note! 1 document with no flaws that don't need to be listed. 🎉 URL:
URL:
(comment last updated: 2025-01-09 03:05:23) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of describing how to compare aspect ratios in the syntax section, let's put the comparison in an example in the @media page.
@@ -11,7 +11,7 @@ The **`aspect-ratio`** [CSS](/en-US/docs/Web/CSS) [media feature](/en-US/docs/We | |||
|
|||
## Syntax | |||
|
|||
The `aspect-ratio` feature is specified as a {{cssxref("<ratio>")}} value representing the width-to-height aspect ratio of the viewport. It is a range feature, meaning you can also use the prefixed **`min-aspect-ratio`** and **`max-aspect-ratio`** variants to query minimum and maximum values, respectively. | |||
The `aspect-ratio` feature is specified as a {{cssxref("<ratio>")}} value representing the width-to-height aspect ratio of the viewport. It is a range feature, meaning you can also use the prefixed **`min-aspect-ratio`** and **`max-aspect-ratio`** variants to query minimum and maximum values, respectively. The aspect ratio is [compared using the quotient's numeric value](/en-US/docs/Glossary/Aspect_ratio#comparing_aspect_ratios). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the user is looking for an explanation of min- vs. max- aspect ratio not how to compare them. I am not sure this is useful or addresses the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue title confused me. :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the whole example:
- made the intro clearer, including the sample HTML code.
- added/updated media query comments
- used uniform colors to avoid confusion: #99f, #9f9, #f99 (blue, green,red)
- added a border to the iframe to get a better feel of the shape
- show live aspect ratio so that the viewport's shape and aspect ratio can be related
- added explanation about max and min media query props
fd3a4f3
to
f364877
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Onkar. two comments....
Co-authored-by: Estelle Weyl <[email protected]>