I have been focusing on improving the performance of my web application, and one approach I took was to utilize CSS sprites. All of my images are now consolidated in a single .png file named images.png.
While CSS sprites have worked effectively for displaying images once within css classes, I encountered an issue with images that needed to be repeated. For example, I have a banner.png image used as the background for a banner. When I attempted to set the background-repeat property, the image did not repeat as desired. Below are my CSS definitions:
Before CSS Sprites
------------------
.ghwc {
background-image: url(/images/layout/banner.png);
background-repeat:repeat-x;
color:White;
width:300px;
}
After CSS Sprites
-----------------
.ghwc {
background-image: url(/images/images.png);
background-repeat:repeat-x;
color:White;
background-position:60px 319px;
width:300px;
}
My query is how to effectively implement CSS sprites for repeated images such as backgrounds?
Thank you,