Image not scaling responsively both width & height
See original GitHub issueHello
ReactCrop container doesn’t seem to be containing the img (ReactCrop__image) when scaling. I can have it scale at smaller sizes but when the ReactCrop container height reaches my component height ReactCrop__image continues to grow.
Is there any CSS examples where the container, image and crop selection all scale proportionally and when boundaries are met all 3 stop scaling? My latest attempt is below where ReactCrop div is positioned centre centre in my component.
.component {
position: relative;
width: 100%;
height: calc(100vh - 480px);
.ReactCrop {
display: block;
position: absolute;
top: 50%;
left: 50%;
width: auto;
height: auto;
max-height: 100%;
transform: translate(-50%, -50%);
.ReactCrop__image {
display: block;
width: auto;
max-width: 100%;
height: auto;
max-height: 100%;
}
}
}
Cheers
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Setting Height And Width On Images Is Important Again
To prevent layout shifts and improve performance scores, we need to always set width and height attributes on our images.
Read more >How to Resize Images Proportionally for Responsive Web ...
Another way of resizing images is using the CSS width and height properties. Set the width property to a percentage value and the...
Read more >Responsive Image Resize Issue - Stack Overflow
What you need to do is give the image a width of 100% and a height of auto. This will make it stay...
Read more >Responsive Web Design Images - W3Schools
Resize the browser window to see how the image scales to fit the page. Using The width Property. If the width property is...
Read more >CSS Responsive Image Tutorial: How to Make Images ...
To make an image responsive, you need to give a new value to its width property. Then the height of the image will...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@DominicTobias fixed! thx a lot!
see here for fix: https://github.com/DominicTobias/react-image-crop/releases/tag/8.3.0