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

Support aspect-ratio CSS property #259

Open
chungyc opened this issue Jan 12, 2024 · 2 comments · May be fixed by #266
Open

Support aspect-ratio CSS property #259

chungyc opened this issue Jan 12, 2024 · 2 comments · May be fixed by #266

Comments

@chungyc
Copy link
Contributor

chungyc commented Jan 12, 2024

Add support for the aspect-ratio CSS property. It specifies a desired aspect ratio for a display element.

  • auto
  • ratios in the form of 1/1, 16/9, 2, or 0.5
  • fallback values with auto and a ratio; e.g., auto 1/1 or 1/1 auto
  • one of inherit, initial, revert, revert-layer, unset

I think we can support this by adding an aspectRatio function to Clay.Geometry. Its argument could be a Rational for ratios, a tuple of (auto, ratio) or (ratio, auto), or the usual set of auto, inherit, ... values. Its argument type could be a type class like AspectRatioValue, of which Rational and Value could be made instances. E.g.,

aspectRatio auto
aspectRatio initial
aspectRatio (16%9)
aspectRatio (16%9, auto)

This issue is mainly stating my intention to implement support for aspect-ratio and to track any work related to it, rather than a feature request for someone else to implement.

Note that this is distinct from the aspect-ratio media feature, which is already supported with Clay.Media.aspectRatio.

@turion
Copy link
Collaborator

turion commented Jan 13, 2024

That sounds like a great addition! Note that aspect-ratio: auto 3/4; is also valid CSS. Do you want to submit a PR?

@chungyc
Copy link
Contributor Author

chungyc commented Jan 13, 2024

Do you want to submit a PR?

That's my plan ... eventually.

@chungyc chungyc linked a pull request Oct 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants