I've got some code that uses sprites, this is designed to look like a horizontal navigation bar. My question is: for my code shown below, does this method actually cause the end user to download the png image 8 times or just the once.
And if it is actually once, is there a better method to do this?
CSS Code
#facebook, #twitter, #linkedin, #googleplus {
width: 64px;
height: 64px;
display: inline-block;
}
#facebook {
background: url("images/sprite.png") 0 0;
}
#twitter {
background: url("images/sprite.png") -64px 0;
}
#linkedin {
background: url("images/sprite.png") -128px 0;
}
#googleplus {
background: url("images/sprite.png") -192px 0;
}
#facebook:hover {
background: url("images/sprite.png") 0 -64px;
}
#twitter:hover {
background: url("images/sprite.png") -64px -64px;
}
#linkedin:hover {
background: url("images/sprite.png") -128px -64px;
}
#googleplus:hover {
background: url("images/sprite.png") -192px -64px;
}
HTML Code:
<nav>
<a id="facebook" href="https://www.facebook.com"></a>
<a id="twitter" href="https://www.twitter.com"></a>
<a id="linkedin" href="https://www.linkedin.com"></a>
<a id="googleplus" href="https://plus.google.com"></a>
</nav>