What is sprite images ?
An sprite images is a collection of multiple images use in a single image. Multiple images take a long time to generate server requests in a web-page. Sprite image helps in reducing the server requests.
Here is an example explaining the usage of Sprite Image:-
In a web-page you have multiple images, to be rendered each time when that web-page is requested. Instead of rendering those multiple images at once, you can add those images into one.
CSS Example:-
.navbar{
width:100%;
}
.navbar-nav li{
float:left;
list-style:none;
margin:30px;
}
.golf, .cycling, .running, .tennis, .swimming{
background-image:url(../images/Background.png);
width:50px;
height:50px;
}
.golf{
background-position:0px 0px;
}
.cycling{
background-position:-50px 0px;
}
.running{
background-position:-100px 0px;
}
.tennis{
background-position:-150px 0px;
}
.swimming{
background-position:-200px 0px;
}
HTML Example:-
THANKS
More From Oodles
Ready to innovate? Let's get in touch
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Mandeep Kundu
Mandeep is a young UI designer with experience in building UI for Web and Mobile Applications