I'm trying to create a website, where the background image is going to be centered, and and it will resize itself based on the web browser window, but only till reaching its original size. After that it will stop becoming larger and just stay centered. Is there a way to do this using CSS? I have drawn some examples to better explain myself. Here, width of the site is larger than the width of the actual image, so the image reaches its maximal width and stays there. However, the height of the image shown is either higher or equal to the height of the window, so it comes from top to bottom. Also if the width of the site is larger than the width of the picture, but height isn't, I don't want to see just a part of that picture, I would love it to automatically resize so it fits the screen - something like zooming. And here is shown that if the height and width of the site are greater than the width and height of the actual picture, it just stays centered. I've got some code, but I cannot get it working since I'm pretty new to CSS. Code:
body{
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}