关于CSS颜色代码的简单问题
CSS 颜色代码为 RR GG BB。那么#26c
与蓝色有何关系呢?
编辑:
哇,感谢大家的帮助 - 我将标记似乎付出了最大努力的人的答案
CSS color codes are RR GG BB. So how does #26c
relate to a shade of blue?
Edit:
Wow thanks for everyones help - I'll mark the answer of the one who appears to have put most effort in
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
#26c
是网络安全的十六进制颜色代码。十六进制颜色通常有 6 个字符长,例如黑色是#000000
,白色是#ffffff
。网络安全颜色只有三个字符长,加倍后,因此#26c
变为#2266cc
。之所以与蓝色相关,是因为十六进制代码的计算方式。 22代表颜色从1到255中红色的数量,66代表代码中绿色的数量,CC代表蓝色的点数。
但CC如何表示金额呢?
嗯,我很高兴你问,计算机喜欢计算八位数字的数量,因此开发了一个基于 16 次方的数字系统,所以你在达到 16 之前不会重新开始,但从 11 到 15 你使用字母。所以10是A,11是B,12是C,13是D,14是E,15是F。
所以当使用十六进制计算时,CC变成204(12+12x16),意味着颜色中有204个蓝色点。这是最高值,意味着颜色大部分是蓝色:)
#000000
表示 0 红色、0 绿色和 0 蓝色,这就是为什么它是黑色的,完全没有颜色。#ffffff
表示 255 红色、255 绿色和 255 蓝色,这就是为什么它是白色的,所有颜色加在一起就是白色。之间的所有颜色都可以这样计算:)希望有帮助。 :)
#26c
is a Websafe hexadecimal colorcode. Hexadecimal colors are usually 6 characters long, for example black is#000000
and white is#ffffff
. Websafe colors are only three characters long that double up, so#26c
becomes#2266cc
.The reason why this relates to a shade of blue is because of the way Hexadecimal codes are calculated. 22 represents the amount of RED in the color from 1 to 255, 66 represents the amount of green in the code and CC represents the points of blue.
But how can CC represent an amount?
Well I'm glad you asked, computers like to count in amounts of EIGHT digits and so have developed a number system based on powers of 16, so you don't start over til you get to 16, but from 11 - 15 you use letters. So 10 is A, 11 is B, 12 is C, 13 is D 14 is E and 15 is F.
So when calculated using Hexadecimal, CC becomes 204 (12+12x16), meaning 204 points of blue in the color. this being the highest value, will mean the color is mostly blue :)
#000000
means 0 red, 0 green and 0 blue, that's why it is black, totally devoid of color.#ffffff
means 255 red, 255 green and 255 blue, that's why it is white, all the colors added together makes white. And all the colors in between can be calculated this way :)Hope that helps. :)
这是 css 的快捷版本,它呈现为 #2266CC
CC 值较高,它至少应该看起来有点蓝色:D
This is the shortcut version of css, it renders as #2266CC
CC being the higher value, it should look a little blue at lease :D
这是一种紧凑的书写方式#2266CC
It's a compact way of writing #2266CC
这是简写形式,CSS 将每个 3 位数代码加倍以读取
#2266CC
It's short hand, CSS doubles up each of the 3 digit codes to read
#2266CC