Home >Web Front-end >HTML Tutorial >I would like to ask you a question about the http request for background images, please let me know. _html/css_WEB-ITnose

I would like to ask you a question about the http request for background images, please let me know. _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:14:541609browse

My question is as follows:

Method 1:
/*css part*/
.class1{background-image:url("1.jpg")}
.class2 {background-image:url("1.jpg")}

/*html part*/




How many http requests are made in this way?


Method 2:
/*css part*/
.class1{background-image:url("1.jpg")}

/*html part */



How to write this, http request How many times?

I don’t know much about it, so I just want to ask for advice on this issue.
I also ask the experts to give me some advice.


Reply to the discussion (solution)

The same URL is only requested once, and subsequent content is fetched from the cache

All once The browser has Cached
For example, some js frameworks will be downloaded once when they are loaded for the first time. When you use them on other pages, they will look for
in the cache. Of course, there is also recycling. The specific time is not clear. Check online. Check

Thank you both above for your replies.
It’s useless to say more, just leave a comment.

Sorry, I don’t know how to set the points. I can only set 10 points per person.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn