加入收藏 | 设为首页 | 会员中心 | 我要投稿 源码门户网 (https://www.92codes.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 创业 > 经验 > 正文

CSS Sprites:实用技巧,还是潜在危险?[译]

发布时间:2018-09-16 22:39:58 所属栏目:经验 来源:站长网
导读:无处不在的CSS sprites是为数不多的几个可以绕过逐渐流行阶段,而直接让自己成为CSS最佳实践的Web设计技巧中的一个。尽管在A List Apart对它进行一个解释以及赞同认可这种方式之前,它还没有真正地流行。它最早是由Petr Stancek.在2003年7月提出来作为一个

无处不在的CSS sprites——是为数不多的几个可以绕过“逐渐流行”阶段,而直接让自己成为CSS最佳实践的Web设计技巧中的一个。尽管在A List Apart对它进行一个解释以及赞同认可这种方式之前,它还没有真正地流行。它最早是由Petr Stanícek.在2003年7月提出来作为一个CSS的解决方案。

Ah, the ubiquitous CSS sprites — one of the few web design techniques that was able to bypass “trend” status almost instantly, planting itself firmly into the category of best practice CSS. Although it didn’t really take off until well after A List Apart explained and endorsed it, it was discussed as a CSS solution as early as July, 2003 by Petr Stanícek.

当今许多web程序员对这项技巧(CSS sprites)有着很娴熟的应用能力,介绍CSS sprites的教程和文章也是不计其数。几乎在每一篇教程中,都要求设计师以及程序员应该实施CSS sprites以减少HTTP请求和节省带宽。迄今为止,这项技术已经被许多网站所应用了,包括亚马逊,正在使用着极大数量的sprites图片。

Most web developers today have a fairly strong grasp of this technique, and there have been countless tutorials and articles written on it. In almost every one of those tutorials, the claim is made that designers and developers should be implementing CSS sprites in order to minimize HTTP requests and save valuable kilobytes. This technique has been taken so far that many sites, including Amazon, now use mega sprites.

可是 这项技术被广泛热议的带来的好处真的值得么?设计师们是否可以在没经过仔细考虑所有方面的因素的情况下转而使用CSS sprites?在这篇文章中,我将来讨论一下CSS sprites的一些赞同或者反对使用CSS sprites的意见,尤其集中在大量使用的sprites,以及为什么这样子使用CSS sprites在许多情况下是等同于浪费时间。

Is this much-discussed benefit really worthwhile? Are designers jumping on the CSS sprite bandwagon without a careful consideration of all the factors? In this article, I’m going to discuss some of the pros and cons of using CSS sprites, focusing particularly on the use of “mega” sprites, and why such use of sprites could in many cases be a waste of time.

原文地址  译者:solari

(编辑:源码门户网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读