Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

css - 是否有理由将大写字母用于十六进制CSS颜色值?(Is there a reason to use uppercase letters for hexadecimal CSS color values?)

I see that colors in CSS properties values are commonly written in the uppercase form:

(我看到CSS属性值中的颜色通常以大写形式书写:)

.foo .bar {
  background-color: #A41B35;
  color: #FFF;
}

But you can also use:

(但您也可以使用:)

/* Same same */
.foo .bar {
  background-color: #a41b35;
  color: #fff;
}

It looks like using lowercase values does the same, and, CSS values for colors are not case-sensitive .

(看起来使用小写的值也是如此,并且颜色的CSS值不区分大小写 。)

Lots of graphic design software also use the uppercase form.

(许多图形设计软件也使用大写形式。)

And it is very common to find uppercase notations in source code, it looks like there is something like a tradition.

(在源代码中找到大写表示法是很常见的,看起来就像是一种传统。)

I understand about the consistency thing, that it should be the same everywhere in you software, but as the standard doesn't give a good indication, people do what they want or what they are told to do .

(我了解一致性问题,因为它在您的软件中各处都应该相同,但是由于标准不能提供很好的指示,因此人们会按照自己的意愿做事或被告知要做的事情 。)

Is there rational reasons for this, like historic , compatibility, old IE6 hacks, performances or practical reasons?

(是否有合理的原因,例如历史性 ,兼容性,旧的IE6黑客行为,性能或实际原因?)

  ask by smonff translate from so

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

1 Reply

0 votes
by (71.8m points)

I am not aware of any differences other than personal preference.

(除个人喜好外,我没有其他区别。)

Personally, I prefer lowercase since it's quicker to read, although in very short strings such as CSS color values, the benefit is probably negligible.

(就个人而言,我更喜欢小写字母,因为它读起来更快,尽管在CSS颜色值之类的很短的字符串中,其好处可能微不足道。)

Really , I think it's just because I think lowercase looks better.

(确实 ,我认为这只是因为我认为小写看起来更好。)

Hexadecimal, however, is traditionally written in uppercase, so maybe I'm - strictly speaking - in the 'wrong'.

(十六进制,然而, 传统上使用大写,所以也许我-严格来说-在“错误”。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...