Categories: Css

CSS Image Sprites

Share

Image sprite is nothing but a collection of images put into a single image. When web page loads then for a particular location we show particular position of a image. For multiple images it takes time to load on a server. That is why we use single image for multiple position to save bandwidth.

In the following example we will show how we can show one image into to parts using Image Sprites:

<!DOCTYPE html>
<html>
<head>
<style>
#img1{
width: 151px;
height: 400px;
background: url(sprite.png) 0 0;
}

#img2{
width: 151px;
height: 400px;
background: url(sprite.png) -148px 0;
}
</style>
</head>
<body>

<img id="img1" src="img_trans.gif"><br />
<img id="img2" src="img_trans.gif">

</body>
</html>

Recent Posts

Unlock Growth – Guide to Online Financing and Business Loans for Entrepreneurs

If you are in a financial crisis , or need to start a new business…

23 hours ago

Optimize Your Hormonal Balance: Enclomiphene Citrate for Enhanced Wellness

Hormonal balance plays a pivotal role in overall well-being, influencing various aspects of health, from…

2 days ago

Paul Kanes Explores the World of Canine Companionship through Dog Walking

Dog walking is an excellent way to maintain your furry friend's camaraderie and provides many…

2 days ago

Top 5 Must-Have Features Every Mobile App Needs to Succeed

Introduction Businesses understand the diverse requirements of mobile applications, which provide a competitive advantage. There…

2 days ago

IoT Data Analytics: Ways to Gain Value from IoT Data

The Internet of Things (IoT) has recently changed the world. It links gadgets together and…

2 days ago

The Rise of NFTs: Exploring the Impact of Non-Fungible Tokens on the Digital Economy

NFTs, or Non-Fungible Tokens, are revolutionizing the digital economy. These unique digital assets, authenticated through…

3 days ago