CSS:哪种浏览器更快?颜色:#fff;或颜色:#ffffff; [英] CSS: Which is faster for the browser? color:#fff; or color:#ffffff;

查看:155
本文介绍了CSS:哪种浏览器更快?颜色:#fff;或颜色:#ffffff;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,是的,我知道渲染的颜色相同,我的问题是关于速度的简单查询.

First things first, yes I know the render the same color, my question is is a simple query about speed.

这只是与优化页面加载速度有关的主题,但是标题中的哪个选项将呈现得更快(即使这是最微小的区别)?

This is just a topic of interest regarding optimising page load speeds, but which of the options in the title will render faster (even if it is the tiniest difference)?

我的思维过程是,使用简写版本(#fff),假设十六进制dec的其余部分为fff,则将要求浏览器执行任务.另一方面,由于多余的显式字符,长手版本可能需要更长或更短的时间.

My thought process is that with the shorthand version (#fff) the browser will be tasked with assuming the rest of the hex-dec is fff. On the other side the longhand version might take longer or less time because of the extra explicit characters.

我认为有人可能可以对这个话题有所了解.

I figured someone might be able to shed some light on the topic.

推荐答案

#fff的字符较少,通常更好.在大多数情况下,网络延迟和带宽比处理时间更重要.因此,大多数CSS压缩器都会智能地优化到#fff版本.在这种情况下,网络比解析速度更重要.

#fff is fewer characters, which is generally better. Network latency and bandwidth matter more than processing time in most cases. For this reason, most CSS compressors will intelligently optimize to the #fff version. The network matters more than parsing speed in this case.

如果您担心解析时间,我怀疑这两个声明之间的差异是否占解析时间的0.005%.与解析颜色声明相比,存在更大的瓶颈,使任何速度差异都相形见

If you're concerned about parsing time, I doubt the difference between the 2 declarations accounts for even 0.005% of total parsing time. There are much bigger bottlenecks that dwarf any speed difference compared to parsing color declarations.

这篇关于CSS:哪种浏览器更快?颜色:#fff;或颜色:#ffffff;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆