My div has a width of 950px
. Within this div, I have inserted an img
with a width of 960px
.
I am looking to crop 5px
from the right and 5px
from the left of the 960px image when inserted inside the div. Additionally, I would like the image to be aligned in the center both vertically and horizontally.
One constraint is that the width of the image can vary, so it could be 1000px or any other value. In such cases, I need to proportionally cut the image on both sides.
I attempted to address this issue but my previous solution did not work. center oversized image in div