Most noticeably the quality of the server will improve the speed at which users can fetch images. However, you can easily optimise some things when you are loading multiple backgrounds in CSS.
First it is important to know that even though an element is not visible (e.g. display: none
) its background-image as defined in a CSS file will still be loaded. (Load this fiddle and take a look at the network tab of your devtools, you'll see that the image is loaded.) This is some important information because it means that parallel requests will be made for all images (even the ones not visible) eating away the bandwidth. In other words, the speed of loading is slow partially because the browser is loading images it doesn't need yet.
For a solution you'll need some JavaScript because you need to do a few things:
- initially only load the background-image that you need (can be done in CSS)
- load other images in the background
- dynamically insert the CSS
background
property to the elements as soon as the loading has finished
Another solution would be to use lazy loading, in which rather than loading the images in the background any way, only start loading the images when you are (relatively) certain the user will need to see the background image (for instance when the position of the image is close to become visible in the viewport).