How to center crop an image (<img>) in fluid width container
问题 How do I get an image to stay centered when its fluid width (percentage based) container is too small to show the whole image? How can I center the image inside it's container This means it should show the middle of the image instead of the sides when container is too small. 回答1: When It Works You might have a container that holds some content such as two <div> s that are 50% wide each, sitting next to each other. For this example, we can illustrate just one child of the container: We'll name