![html - Stretch half an image to fit in a div and half overflow in mobile and half image display in half portion of div in desktop? - Stack Overflow html - Stretch half an image to fit in a div and half overflow in mobile and half image display in half portion of div in desktop? - Stack Overflow](https://i.stack.imgur.com/cVS2Y.png)
html - Stretch half an image to fit in a div and half overflow in mobile and half image display in half portion of div in desktop? - Stack Overflow
![javascript - How to tightly wrap a div around an image, but also resize the image to fit a content area if resolution is larger than content area? - Stack Overflow javascript - How to tightly wrap a div around an image, but also resize the image to fit a content area if resolution is larger than content area? - Stack Overflow](https://i.stack.imgur.com/dzHpo.png)
javascript - How to tightly wrap a div around an image, but also resize the image to fit a content area if resolution is larger than content area? - Stack Overflow
![Simple CSS Solutions: How to fit images with different dimensions in set containers | by Kimberly Luu | Medium Simple CSS Solutions: How to fit images with different dimensions in set containers | by Kimberly Luu | Medium](https://miro.medium.com/v2/resize:fit:394/0*EPYBPF6dVduFEMTJ.png)
Simple CSS Solutions: How to fit images with different dimensions in set containers | by Kimberly Luu | Medium
![So I want the parent div to have enough height to fit the child div(as shown in the snapshot). Worthy to not I used position: relative and edited the child div's positions So I want the parent div to have enough height to fit the child div(as shown in the snapshot). Worthy to not I used position: relative and edited the child div's positions](https://preview.redd.it/qbvo5ae362i91.png?auto=webp&s=633ab4010a318bf3c04b2b72bd790f9673d51f3a)