Skip to content

Image with object-fit and object-position #93

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

Open
zatakiya opened this issue Feb 15, 2025 · 1 comment
Open

Image with object-fit and object-position #93

zatakiya opened this issue Feb 15, 2025 · 1 comment

Comments

@zatakiya
Copy link

zatakiya commented Feb 15, 2025

Thanks for the awesome library.

New to this library and finding it hard to make this library work with image where object-fit and object-position is used. I have a case where container's aspect ratio is different than image's intrinsic aspect ratio. So I need to set following properties on image

object-fit: cover; object-position: center; overflow: hidden;

@NishargShah
Copy link
Member

NishargShah commented Feb 15, 2025

Hello @zatakiya

In that case, you can use the img-mapper-img class name or you can use imgProps.style ( https://github.com/img-mapper/react-img-mapper/blob/master/src/ImageMapper.tsx#L310-L314 )

Check doc: https://github.com/img-mapper/react-img-mapper?tab=readme-ov-file#properties ( imgProps )

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

No branches or pull requests

2 participants