A child with width greater than its container's width overflows:

width: 150px

Setting max-width: 100% causes a child to become no bigger than its parent:

width: 150px

But if the parent is bigger than the child, the child will expand to its actual width:

width: 500px

Why not set width: 100% instead? Because the the image will stretch and be too large and distorted in big containers:

width: 500px