The document discusses different ways to create CSS sprites in Rails applications. It describes image sprites and how they can improve website performance by reducing HTTP requests. It then provides information on the integrated sprite support in Rails 3.1, the css_sprite gem for generating sprites, and the lemonade gem which provides an easy way to generate sprites. It includes code examples and discusses pros and cons of different sprite approaches.
31. Could be Better
.add {
background:
url(/slideshow/3-waystocreatespritesinrails/4909207/"icons.png");
}
.remove { Example link
background:
url(/slideshow/3-waystocreatespritesinrails/4909207/"icons.png") 0 -16px;
padding: 20px;
}
33. Just Perfect
.add {
background:
url(/slideshow/3-waystocreatespritesinrails/4909207/"icons.png");
}
.remove { Example link
background:
url(/slideshow/3-waystocreatespritesinrails/4909207/"icons.png") 0 -36px;
padding: 20px;
}
34. Sprite Generation
¡ï Sprite image named by directory:
¡°icons/*.png¡± > ¡°icons.png¡±
¡ï Background position added only if needed
¡ï Add ¡°no-repeat¡± by yourself:
background:
sprite-image("¡") no-repeat;