So, I have a site I’m working on where there are images displayed on click. When I set the images in the CSS to have an “absolute path”, the images appear with a delay, even though I have quite fast internet connection.
First, I thought to ask: “Do the images load faster if their path is set relatively?“, but then I tried it out, and figured out that they do load faster. But what is the reason they load faster that way?
Here’s my example:
#exampleDivOne {
background-image: url(background-image: url("../wp-content/uploads/2023/04/example.svg");
}
<div id="exampleDivOne"></div>
The following loads significantly slower than the one above.
#exampleDivTwo {
background-image: url("https://example.com/wp-content/uploads/2023/04/example.svg");
}
<div id="exampleDivTwo"></div>