I'm trying to show the original size of the image. Often that's bigger than the width of the div that's containing it.
In modern browsers, it gets automatically resized to fit the parent div. Even when I use overflow: auto
the image still gets resized.
So how can I prevent the image from getting resized when the outer div has a set width?
Thank you!
How to auto-resize an image to fit a div container using CSS? To auto-resize an image or a video to fit in a div container use object-fit property. It is used to specify how an image or video fits in the container.
Resize images with the CSS width and height properties ¶. Another way of resizing images is using the CSS width and height properties. Set the width property to a percentage value and the height to "auto". The image is going to be responsive (it will scale up and down).
How to disable resizable property of textarea using CSS? This resizable property is used to set the resizable area of elements. It is mostly used with textarea and div elements. To disable resizable property of an element use resize to none. It is the default value. geeks.
Otherwise, the image can get distorted and lose its quality. Another way of resizing images is using the CSS width and height properties. Set the width property to a percentage value and the height to "auto". The image is going to be responsive (it will scale up and down). Note that the image could be scaled more than the original size.
I used this one img {min-width:100%}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With