关于CSS颜色代码的简单问题

发布于 2024-10-13 08:33:44 字数 120 浏览 3 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

夜血缘 2024-10-20 08:33:45

#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. :)

淑女气质 2024-10-20 08:33:45

这是 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

极度宠爱 2024-10-20 08:33:45

这是一种紧凑的书写方式#2266CC

It's a compact way of writing #2266CC

圈圈圆圆圈圈 2024-10-20 08:33:45

这是简写​​形式,CSS 将每个 3 位数代码加倍以读取 #2266CC

It's short hand, CSS doubles up each of the 3 digit codes to read #2266CC

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文