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

image-aspect-ratio #314

Merged
merged 3 commits into from
Oct 1, 2021
Merged

image-aspect-ratio #314

merged 3 commits into from
Oct 1, 2021

Conversation

scco
Copy link
Contributor

@scco scco commented Oct 1, 2021

as we discussed in

#301

about image crop - i enabled the UI to work with ALL image dimensions by wrapping images into a container what is set to a specific aspect ratio, that masks the image nicely into the desired format .

so we can bring images to any desired aspect ratio like this

<figure class="aspect-w-16 aspect-h-9">
   <img class="w-full h-full object-center object-cover" src="" />
</figure>

as the native css support for aspect-ratio is still not the best ( missing edge/IE ) i decided to go with a tailwind plugin
https://github.com/tailwindlabs/tailwindcss-aspect-ratio
that works niceley - via the old "padding-bottom-trick"

you need to rerun yarn install before you can see it working.

if you want to try out how this truly looks with other dimension images you can easy replace the image source of a card or detail page with a rectangle image via inspector of your browser src="http://placekitten.com/1000/1000" or just create a new grant :)

@mds1 mds1 force-pushed the richard-image-aspect-ratio-masks branch from 5d25db1 to c228d35 Compare October 1, 2021 16:53
@mds1 mds1 merged commit 67b1af3 into main Oct 1, 2021
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 this pull request may close these issues.

4 participants