Image container is bigger than image
See original GitHub issueOS: macOS
React-pdf version: 1.1.1
Description: Image in portrait format (ratio < 1) with a maxWidth style are centered in a container of that width.
For example, if we have an image which is 300x400 and we style it with { maxWidth: 250, maxHeight: 250 }
, then the container’s width will be larger than the image itself, like so :
How to replicate issue including code snippet (if applies):
<Image
style={{
maxWidth: 250,
maxHeight: 250,
}}
src={url}
/>
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
div container larger than image inside - css - Stack Overflow
inside the wrapper there is a menu (the little red thing is part of that menu), then there is a div (id=container) whos...
Read more >Images Larger than Container CSS - DEV Community
This will center the image inside of a element when the elements height and/or width is smaller than the image.
Read more >How to break an image out of its parent container with CSS
This trick comes courtesy of CSS expert Una Kravets. A simple utility class, .full-width , will break the image out of it's parent...
Read more >Sizing items in CSS - Learn web development | MDN
Images should be appropriately sized to be no larger than they need to be for the largest size they are displayed in the...
Read more >How to Auto-resize an Image to Fit into a DIV Container using ...
You can simply use the CSS max-width property to auto-resize a large image so that it can fit into a smaller width <div>...
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 FreeTop 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
Top GitHub Comments
Hey @diegomura ! It took me a lot of time to get back to you on this, sorry. It works fine with
alignItems: "flex-start"
. Thanks again !Btw, this is the snippet that produced that image:
My apologizes if I wasn’t clear enough about the root of this issue. Yoga can be sometimes cryptic to understand 😅