Where to declare/load background image sprites for CSS so that it loads only once? -
i want use single image sprite web page, should declare in css?
should in body or where?
example:
body { background-image:url(/img/sprites.png); } #somediv { background-position: -10px -20px; /* can this? */ } #someotherdiv { background-position: -30px -40px; /* , this? */ }
haven't tried because want know first if possible construct sprites.
thanks
you reference same image each selector:
a.mylink { background-image: background-image:url(/img/sprites.png); } a.mylink:hover { /*you don't need re-define styles hover elements, unless want them change*/ background-position: -50px 0; } #someotherdiv { background-image: background-image:url(/img/sprites.png); background-position: -130px -40px; /* , this? */ }
there no "global include" in css, reference in each selector. loaded once :)
Comments
Post a Comment