background-size: contain

Resize the browser window to see the effect.