I am using CSS sprites however when i hover over it is making another request for the same image and causing a flicker. Any idea why its making 2 requests? Here is my code:
.btn-red-lrg .left {background:url(../images/site-sprite.png) no-repeat 0px 0px transparent;width: 9px;}
.btn-red-lrg:hover .left {background:url(../images/site-sprite.png) no-repeat 0px -37px transparent;width: 9px;}
Dont’ use the
background-shorthand property. Usebackground-positioninstead, since you only want to update the position.Specifying a
background-image:url(...)on the:hoverpseudo-class can result in a new request if the caching mechanism aren’t sufficient or the expiration date is missing/wrong (see Jeff’s answer). Altering the position only won’t result in a new request regardless of the browser.