My website features a 3-level structure that consists of a "workingArea" and an "imageContainer" within it, containing an image.
<div class="workingArea">
<div class="imageContainer">
<img class="theImage" />
</div>
</div>
The size of the "workingArea" is determined by the browser's dimensions through the use of flex in the parent element. On the other hand, the size of the "imageContainer" is dependent on the loaded image, varying with each individual image.
My goal is to center the "imageContainer" within the "workingArea". However, there's a small obstacle: if the "imageContainer" happens to be larger than the "workingArea," I want the center of the image to align with the center of the working area, causing the image to overflow to the left and right.
Although I attempted to use flex properties for centering, I struggled to achieve horizontal alignment alongside vertical alignment.
If you'd like to see a simulation of this issue in JSFiddle, please click here.
Thank you for your help!