Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

If a page has multiple facebook/twitter buttons for multiple stories (24 buttons for 24 stories), its creating 24 files for fb likes and 24 folders for twitter where count is saved. This is making the page heavy unnecessarily. Can we store it in single file? Please help.

share|improve this question

1 Answer 1

You need to start using css sprits, this allows you to load one image file and with css display only the section of the image that you need.

img.home {
    width:46px;
    height:44px;
    background:url(img_navsprites.gif) 0 0;
}

In the example above you see that starting at position 0x0 in the image we display a rectangle 46px x 44px.

share|improve this answer
    
You should not use or link to w3schools. It's not a reliable source of information and we don't want to encourage its use. I recommend using the Mozilla Developer Network instead. (But +1 for a good answer nonetheless). –  John Conde Aug 19 '13 at 22:10
    
Good point @JohnConde, I've changed the reference. –  Daniël W. Crompton Aug 19 '13 at 22:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.