Isaac Isaac - 1 month ago 9
CSS Question

When does css file retrieve background-img URL?

When a .css file uses a url for an image file, does the client retrieve that image when the .css file is loaded or does it wait until the specific class is assigned to an element?

For example -

A user loads home.html with style.css referenced in the header. The home page does not include any elements with class

, but within style.css we have


Will background.png be retrieved when home.html is hit? Or does the image only get requested when an element meets the css selector criteria?


it will be retrieved on page load, when the class .attach_background_image is loaded