Isaac Isaac - 1 year ago 85
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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download