top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

In Css how can i use single image from the collection of images?

0 votes
395 views

I have an image called social-share-icon.gif.This image containing facebook,twitter and google+ icon.

In Css i need to use all icon as seperate.I don't have any idea how to use this.

Some one please help with example code.

posted Jul 7, 2014 by Manish Tiwari

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

An image sprite is a collection of images put into a single image.

A web page with many images can take a long time to load and generates multiple server requests.

Using image sprites will reduce the number of server requests and save bandwidth.

    <style>
    img.facebook {
        width: 46px;
        height: 44px;
        background: url(social-share-icon.gif) 0 0;
    }

    img.twitter {
        width: 43px;
        height: 44px;
        background: url(social-share-icon.gif) -91px 0;

 img.google+ {
        width: 43px;
        height: 44px;
        background: url(social-share-icon.gif) -91px 0;
    }
    </style>
    </head>
    <body>

    <img class="home" src="(social-share-icon.gif)"><br><br>
    <img class="next" src="(social-share-icon.gif)">

    </body>
answer Jul 9, 2014 by Vrije Mani Upadhyay
...