my website works good in pc or laptop but when it is viewed an actual mobile the background image too much zoomed due to which i get blurred background image for mobile devices
the code for background image for whole body is below
What is your background original size?
Perhaps you’re watching the background on a smartphone with high resolution display, but your background original size is small.
Furthermore, your CSS is using:
& of course PC & smartphone have different types of orientation (landscape/portrait).
For example:
Your background/image original size: 800x600 px (landscape)
Your PC resolution: 1280x800 px (landscape)
Your smartphone resolution: 750x1334 px (portrait)
Then:
cover tells the browser to make sure the image always covers the entire container, even if it has to stretch the image or cut a little bit off one of the edges.
That image on PC is still good because their size ratio are still balance, eventhough the image must be scaled up to cover entire screen.
But the image on smartphone is bad.
The high of image is only 600 px. The high of smartphone is 1334 px. Because of orientation different, the gap is too much.
That 600 px must be scaled up until it fills (cover) the entire screen (1334 px). Of course it will becomes blurry when it’s enlarged beyond its own size.
Other value beside cover:
contain , on the other hand, says to always show the whole image, even if that leaves a little space to the sides or bottom.
The default keyword — auto — tells the browser to automatically calculate the size based on the actual size of the image and the aspect ratio.
& you can also use the actual image size: background-size: 800px 600px;