Cascading Style Sheets/Sprites

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Use background-position:0 -## where ## is equal to the y-coordinate of the first pixel of the desired area to reposition sprites

Use the background-position property to change the hover state of links with background images using CSS sprites

Use background-image instead of the background shorthand when using ID selectors to avoid inadvertently overriding class-based background-position changes for CSS sprites

Use the clip property on image tags to do foreground spriting

Make sure class selectors aren't inadvertently overridden by default values of ID selectors, especially background-position changes for sprites, by dividing the properties of ID selectors using longhand notation

References[edit | edit source]

Extending CSS Spriting

CSS Sprites are Stupid