CSS sprite 对移动网站也有用吗?
CSS sprite 对移动网站也有用吗?将所有可能的图像组合起来会不会很好。但所有内容都没有在同一页面上使用?移动浏览器的缓存空间有限。
Is CSS sprite also useful for mobile websites? Would it be good to combine all possible images to combine. but all are not being used on same page? Mobile browsers has limited cache space.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
非常重要,如果您的目标浏览器支持它。现代浏览器(Android、iPhone、WP7)当然可以。精灵图像通常不会很大,减少请求对于移动网络来说是一个巨大的胜利。
Very much so, if your target browsers support it. Contemporary browsers (Android, IPhone, WP7) certainly do. Sprite images are typically not huge, and reducing requests is a big win on mobile networks.
要比 Craig Stuntz 的回答更进一步,只加载您需要的内容。将精灵分成几组(例如,在所有页面上加载的图像、在 X 页面上加载的图像、在 Y 页面上加载的图像等)。占用
空间越小越好。
To go one step further than Craig Stuntz answer, only load what you need. Separate your sprites out into groups (eg, Images that load on all pages, Images that load on page X, images that load on page Y, etc.)
The smaller the footprint the better.