Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thecymaera/aspect-ratio-element
https://github.com/thecymaera/aspect-ratio-element
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/thecymaera/aspect-ratio-element
- Owner: TheCymaera
- Created: 2022-02-08T10:18:20.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-02-12T13:47:00.000Z (almost 3 years ago)
- Last Synced: 2024-11-30T10:15:30.946Z (28 days ago)
- Language: HTML
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Aspect Ratio Element
## Installation
Install via [NPM](https://www.npmjs.com/package/aspect-ratio-element).
```shell
npm install aspect-ratio-element
```## Information
This library registers `` using the [Custom Elements API](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements).```html
```
## Why not just use CSS?
CSS has a new property called `aspect-ratio`, but:
- The element is not constrained on both axes.
- The element's intrinsic size takes priority.
- Safari (incorrectly) requires the element's width or height to be set, preventing its use in layouts that don't use explicit width or height.## License
MIT License
All files can be used for commercial or non-commercial purposes. Do not resell. Attribution is appreciated but not due.