Normally, when content or an image overflows outside a div, the overflowing content is shown on the right outside the “box”. If you want to position the content to the center, so that overflow is on both sides, you can use this class. This is useful to position an image such that the centre of the image is in focus when it overflows.
/* Class to be added to the content or image inside the container-div */
left: 50%; /* move the image to right by 50% of container size */transform: translateX(-50%); /* pull back by 50% of the image or content size */width: auto;
In the images below, the red lines mark the boundaries of the container div.