Lazy Load or HUGE CSS-sprite (9MB in size)

删除回忆录丶 提交于 2019-12-11 01:12:35

问题


The conditions:

  • It's a movie website with approximately 1000 images of 15kb

  • Approximately 70% of all images will be loaded on a page visit

  • Images will have a long expiry date.

I think I will chose CSS-sprites because most images will be loaded by the visitors any way. But the CSS-sprite of all images are 9MB and 15000x2000px. Even if I devide it into 3 sprites it's 3MB :S

Maybe such big sprites will cause some problems?

Will images be cached by the browser even if they are 3-9MB?

Will the big pixel dimensions be any problem for the browser?

Lazy load or CSS-sprite, what should I chose?

Please advice me!


回答1:


Yes this will cause problems:

  • Due to the sprite size and dimensions, it will significantly consum cpu power
  • if you use it often on one page, it could even decrease scrolling and at least DOM manipulation actions
  • 9MB is too big, do you have a link to that sprite ?

The browser will cache it, if the headers are set correct, that is not the problem

And you dont want to load a 9MB Sprite that is mandatory for a site !!! Mobile ?!?!!

Gekkstah



来源:https://stackoverflow.com/questions/11395911/lazy-load-or-huge-css-sprite-9mb-in-size

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!