CSS sprites remain an option, but “combining images is always faster” is not a sound reason to use them. Small decorative icons can be combined into sprites, while images that convey content should use img elements with appropriate alt text. For sites using HTTP/2, a 2020 Semrush article recommends loading small images separately to avoid the download overhead and maintenance costs of an entire sprite sheet. This advice applies under specific conditions; it is not a performance conclusion for all websites today.
Fewer Requests Do Not Guarantee Better Performance
CSS sprites combine multiple images into a single sprite sheet, with CSS specifying which area to display. A 2015 awoo case study listed combining small icons as one of its optimization measures. After the changes, the site’s HTTP requests fell from 150 to 47, and the article also reported improved loading performance.
However, the same round of changes also included removing unused JavaScript and CSS, as well as combining or inlining files. So the entire improvement cannot be attributed to sprites, nor should these figures be treated as expected results for other websites. They describe the overall optimization results for a particular website at that time.
With HTTP/2, Account for the Cost of the Entire Sprite Sheet
In 2020, Semrush noted that HTTP/2 can multiplex requests and responses over a single connection, and therefore advised against continuing to combine small images into sprites. Request counts are not the only consideration; download volume and maintenance work also matter:
- A page may need to download the entire sprite sheet even if it only needs a single arrow.
- Adding an icon requires editing the sprite sheet and ensuring that the new icon does not occupy an area used by another icon.
- Resizing icons may also require changes to the sprite sheet’s layout and positioning, making maintenance more difficult.
Loading images separately allows a page to request only the images it needs and lets the browser prioritize requests. This makes separate loading worth considering first when using HTTP/2, but these explanations do not establish a speed difference that applies to all websites.
First, Distinguish Between Decoration and Content
How images are used matters as well as how they are delivered. Relevant answers on Webmasters Stack Exchange suggest that decorative icons that do not affect a page’s meaning, particularly sets of images with identical dimensions, are candidates for sprites. Images related to a specific page’s content should use img elements rather than appear only as CSS backgrounds.
For example, if a navigation item already says “Home,” an adjacent graphic that repeats the same meaning can be considered decorative. If an image itself conveys information, its text alternative should not be neglected simply to reduce requests. These answers also note that alt text is not just a search engine concern; screen readers use it too. Before adopting sprites, identify what the images are used for, then weigh delivery and maintenance costs.
CSS sprites: perspectives from across the web
Do you need to create a sprite sheet if you only have a few small images?
Not necessarily. In its 2015 website optimization case study, awoo suggested considering data URIs when only a few small images are needed, or combining images into sprites when there are multiple small icons. These were options proposed for that case, not conclusions about speed that apply to every website. The choice still needs to account for the site's actual circumstances.
How can turning website template elements into sprites help with changing the site's appearance?
One Webmasters Stack Exchange answer suggests that separating template elements into sprites allows a site's appearance to be changed later by modifying the stylesheet, without overwriting images from the old design or rewriting all the HTML. However, this benefit needs to be weighed against sprite sheet maintenance costs: another article notes that adding icons or changing their dimensions may require editing the image and adjusting positioning.
When a button uses a sprite, does hiding its alternative text affect search rankings?
These discussions alone cannot establish whether hiding button text currently affects search rankings or leads to penalties. One discussion suggests that hidden text can provide alternative information when CSS is not supported and can be read by bots and screen readers. It distinguishes these uses from manipulating search engines. Another answer says it is unclear whether this text helps with SEO. These are the contributors' opinions, not current search platform rules.
References
- Will Google penalize me for hiding header text?webmasters.stackexchange.com — Source used in the article above.
- 如何減少HTTP Requests?網頁速度最佳化技巧www.awoo.ai · 2015-02-11T01:20:22+00:00 — Discusses: Do you need to create a sprite sheet if you only have a few small images?
- Is 100/100 PageSpeed score enough? The answer is No.www.semrush.com · 2020-07-30T13:00:00Z — Discusses: How can turning website template elements into sprites help with changing the site's appearance?
- Are CSS sprites bad for SEO?webmasters.stackexchange.com — Source used in the article above.
- Are CSS sprites bad for SEO?webmasters.stackexchange.com — Source used in the article above.
- Are CSS sprites bad for SEO?webmasters.stackexchange.com — Discusses: How can turning website template elements into sprites help with changing the site's appearance?
- Using CSS sprites and hidden text - effect on SEO?webmasters.stackexchange.com — Discusses: When a button uses a sprite, does hiding its alternative text affect search rankings?
- Using CSS sprites and hidden text - effect on SEO?webmasters.stackexchange.com — Discusses: When a button uses a sprite, does hiding its alternative text affect search rankings?
