Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
455 views
in Technique[技术] by (71.8m points)

css - which one is faster: hex color codes or color names?

I just wanted to know if it's faster to use hex color codes or the color names when I want to use it in CSS?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

My guess is the codes will be faster since the names are probably assigned to a look-up table and reference hex codes anyway.

That being said, my guess is the speed difference will be completely negligible.

Here's a performance test I just created. They're neck and neck, though hex codes seems to be just barely faster on 4/5 runs so far: http://jsperf.com/css-color-names-vs-hex-codes


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...