开发者

One Image to Rule Them All: why Facebook and AddThis do that? [duplicate]

开发者 https://www.devze.com 2023-02-09 06:51 出处:网络
This question already has answe开发者_JAVA百科rs here: Closed 12 years ago. Possible Duplicate: Single image file to store all the little images on a page
This question already has answe开发者_JAVA百科rs here: Closed 12 years ago.

Possible Duplicate:

Single image file to store all the little images on a page

Hey,

Facebook are saving all the graphics on their page in a single image. So does AddThis. Why do they do that? How can I use the same techniques and cut the images with JavaScript?


they are called CSS Sprites. It reduces the number of requests made to load the page, thus decreasing load time. The site can just set the background of something to be a small portion of the image.


They do this so they can save connection overhead (otherwise browsers would open up a connection for every single image ~ if uncached).

You don't need javascript to cut up the image: use standard CSS positioning to show specific parts of the image.

0

精彩评论

暂无评论...
验证码 换一张
取 消