1、What is CSS Sprites
CSS sprites allow you to create a single file that contains all the images laid out in a grid, meaning only a single image and only a single server call, with roughly the same file size because the empty space is compressed. In that file, you will place all individual “sprites” that make up your interface separated by enough space that they don’t start running over each other. You’ll then set the background position (using negative values to move the background up) and include enough space around each sprite so that only it appears in the background of the element, effectively masking the rest of the sprite images
2、CSS Sprites的意义
按照yahoo的 rules for high performance web sites的原则,应当较少Client与Server端间的HTTP Request次数。
通过CSS Sprites方法将多张图片组装成单独的一张图片,可以有效减少HTTP请求的次数。
How To: Minimize HTTP Requests – The Most Important Guideline for Improving Web Site Performance
Performance Research, Part 1: What the 80/20 Rule Tells Us about Reducing HTTP Requests
3、CSS Sprites使用
有几篇关于CSS Sprites的文章,基本上把其原理和机制说明得很清楚。
High Performance Web Sites中关于CSS Sprites的内容3.2. CSS Sprites
4、CSS Sprites的问题
由于IE6存在的background的flicker问题IE6/Win, background image on <a>, cache=‘check every visit’: flicker!,有人针对此问题提出了解决方案Fast Rollovers Without Preload
关于IE6的flicker问题,fivesevensix.com上有一篇很不错的研究文章Minimize Flickering CSS Background Images in IE6
另外:brunildo.org的CSS tests and experiments是关于css各种功能不错的参考手册和测试工具。
5、相关资源
What Are CSS Sprites?
http://www.peachpit.com/articles/printerfriendly.aspx?p=447210&rl=1
CSS Sprites: Image Slicing’s Kiss of Death
CSS Sprites Generator
Fast Rollovers Without Preload
JavaScript Sprite Animation Using jQuery
http://www.sitepoint.com/blogs/2007/07/20/javascript-sprite-animation-using-jquery/
http://www.sitepoint.com/blogs/2007/07/05/css-using-percentages-in-background-image/
How to create CSS sprites
Creating Rollover Effects with CSS Sprites
http://www.devarticles.com/c/a/Web-Style-Sheets/Creating-Rollover-Effects-with-CSS-Sprites/
Building a Dynamic Banner with CSS Sprites
http://www.devarticles.com/c/a/Web-Style-Sheets/Building-a-Dynamic-Banner-with-CSS-Sprites/
CSS Sprites and IE/Win Flicker Issue
http://www.brajeshwar.com/2006/css-sprites-and-iewin-flicker-issue/
css用法测试工具:CSS tests and experiments
Technorati 标签: css sprites , 高性能服务器 , high performance web sites , firebug , css , javascript , ajax , xhtml , ie6 , flicker
转载请注明:出家如初,成佛有余 » CSS Sprites研究