You'd need a little bit of JS to determine whether to scale the image based on it's width vs. height. Opera seems to have intelligent image stretching built in. ... Why does running hurt without stretching? ... (Without Resize) - DIV with Form. How to stretch an image to fit within a div . This article describes how to stretch a picture without distorting it so as to retain the appearance of the image in its original form. Bootstrap 3 Issue: Images not fitting DIV? ... (Without Resize) - DIV with Form. You have an image and it's width and height is greater then 400px or width of div. A protip by themusyo about css, musyo, css tricks, html, image resize, and stretch. For example I have 2 images one that is 800x800 pixels and one that is 1200x800 pixels. The 800x800 image will of course resize to be 400x400 and retain it's 1:1 ratio. Experiment with image stretching on company logos or other images that ... [CSS Inside DIV No JavaScript. That's first of (I hope) many posts with such an idea. It requires the image display in the cell which has constant size, and keep aspect ratio. Perfectly fit image without stretching it. Not so famous, yet powerful feature of absolute positioning is stretching a box. JavaScript. Resize a big image into a small one without constraining proportions or stretching it. Resize a big image into a small one without constraining proportions or stretching it. How do I resize an image to fit the screen without stretching with Jquery? Those images on the site you linked to are actual size, so the simple answer is just to resize the image. How do I resize an image to fit the screen without stretching with Jquery? I have an image of approx. Style the content div to be the same width and height as the background image:div#content { width: 20em; height: 30em;} Then position the content up to the same height as the image. Hi, I want to resize the images so that it fits it into the div. Resize or Scale Images changing aspect ratio without stretching? Hi, I need to build an image gallery. You can't really do this without "stretching" the image if the image happens to be less than 300px wide or tall, but you can do it without changing the ratio, which is what I think you mean. Once object-fit: cover is applied to the image ... Center and crop images with a single line of CSS ... when you sign up for Medium. There is one simple way to do this. ... Why does running hurt without stretching? ... Why the image won't fit the DIV. Can i do in the below case....? You can use that image as background of div..div { background-image: url(../images/your-image.png); background-size:cover; background-position:center; background I am using a div with a background image. The resize property specifies whether or not an element is resizable by the user. Learn how to auto resize an image to fit within a DIV without breaking the aspect ratio. Auto resize image to fill container div. I basically like the div to display a background image and a color behind it (via another parent div maybe) so that when the text in the child div is longer than the background image it fills with the background color. I have found I need to set the height of the div to show the background image. The 800x800 image will of course resize to be 400x400 and retain it's 1:1 ratio.