About 193,000 results
Open links in new tab
  1. html - Object-fit not affecting images - Stack Overflow

    Dec 13, 2015 · But using object-fit, you can select how to match image and box dimensions. For example, using object-fit:cover commands to enlarge/downsize the image to completely fill the …

  2. Why does object-fit impact my image quality and how to avoid it

    Jan 23, 2023 · In the "object fit" version, your image is 180 x 202 which means a different aspect ratio. So you are not only resizing the image, you are also distorting it. If I set the width to auto …

  3. html - Scaling, centering and cropping image with object-fit and …

    Jul 21, 2017 · Scaling, centering and cropping image with object-fit and object-position Asked 8 years, 5 months ago Modified 1 year, 1 month ago Viewed 59k times

  4. How can I use "object-fit: contain" in CSS and still have a border ...

    Jul 23, 2021 · Contain isn't really helping here. Instead, set the max width and height of the img to 100%. The system will fit it in either totally top to bottom or side to side, but the img element …

  5. css - Object-fit: cover and object-position: 50% 50% do not center ...

    Jan 26, 2018 · I would like to center the image inside the container using object-fit: cover and object-position: 50% 50%; so that in larger screen sizes it always covers the container and …

  6. html - Object-fit: cover; alternative? - Stack Overflow

    11 I had similar issue. I resolved it with just CSS. Basically Object-fit: cover was not working in IE and it was taking 100% width and 100% height and aspect ratio was distorted. In other words …

  7. CSS image width with object-fit and aspect-ratio - Stack Overflow

    Jun 9, 2023 · The object-fit: contain declaration uses the intrinsic aspect ratio of 2:3 to reduce the width of the image to 238px and the remaining width of the img element is filled with the …

  8. css - How to force image resize and keep aspect ratio? - Stack …

    Upvoted because it's the first to mention object-fit: contain. In my experience, all that's necessary is that plus either a height or width.

  9. css - IE and Edge fix for object-fit: cover; - Stack Overflow

    Jun 13, 2016 · I'm using object-fit: cover; in my CSS for images on a specific page, because they need to stick on the same height. It works great in most browsers. But when scaling my …

  10. Make video fit 100% with any screen resolution - Stack Overflow

    Apr 30, 2016 · In my case I wanted the video to fit neatly in the available space, i.e. scale up only until it touched either the vertical or horizontal edges. I found object-fit: contain did that perfectly.