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

How to Find the Best SEO Consultant in Toronto to Boost Your Rankings

Introduction In today's digital age, having a strong online presence is crucial for businesses in…

18 hours ago

Sharing USB across networks

You may need access to a printer, scanner, webcam, or dongle connected to another computer.…

1 day ago

Tourist Attractions: 5 Top-Rated Must-See Places in Dubai

From skyscrapers to endless deserts, from luxurious malls to Michelin star restaurants, Dubai has it…

1 day ago

Fractional CTO Services: Catalyzing Growth in the Logistics Sector

In today's fast-paced digital world, the logistics and supply chain sector is encountering unprecedented challenges…

2 days ago

Email Marketing Professionals: Masters of Digital Connection

In the vast landscape of digital marketing, one strategy has stood the test of time…

2 days ago

How to Increase E-commerce Site Speed for Fast Conversions?

Website navigation and speed play a significant role in the success of online business. Attractive…

2 days ago