CSS 62.5% 为什么开发者使用它? [英] CSS 62.5% why do developers use it?

查看:20
本文介绍了CSS 62.5% 为什么开发者使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我们可能在 62.5% 之前都使用过 62.5% 作为字体大小,我们在旧 IE 版本中使用它来正确缩放缩放.

I know we all probably used before 62.5% as font body size, we used this for old IE versions to do correct scaling on zoom.

所以,我明白为什么它是这个值,以及它如何处理em".我不明白的是为什么人们仍然使用它?特别是当他们的设计无论如何都不尊重用户字体设置时.

So, I understand why it is this value, and how it deals with "em". What I don't understand is why peoples still use it? Especially when they have design which anyway not respect user font settings.

当它使用一种巧妙的方式时,我并没有反对它,就像那些网站的好例子http://www.polarfoundation.org/ 它完全尊重用户字体设置并根据它调整显示,所以这里绝对需要它并且一切正常.

I'm not have anything against it when it used a clever way, like those one site good example http://www.polarfoundation.org/ it fully respect user font settings and adjust the display to it, so here it is absolutely needed and all fine.

这是一个相反的例子 http://froont.com/ 它与用户的字体无关设置.因此,例如,如果用户在浏览器中使用了超大字体,那么他们的设计就会被破坏.因此,如果他们无论如何都根据62.5%"的魔法值(即10px")进行设计,并从那时起计算所有其他值,为什么不简单地将10px"而不是62.5"这样设计,这样设计就不会被破坏,现在所有浏览器可以毫无问题地处理px"的缩放.

And here is an opposite example http://froont.com/ it has nothing with respect to the user's font settings. So if the user, for example, has an extra large font in browser defaults their design simply become broken. So if they anyway make design based on magic value of "62.5%" which is "10px" and count all other values from that point why not simply put "10px" instead of "62.5" this way design not become broken and nowadays all browsers can handle zoom of "px" without any problem.

所以问题是:

  • 我是不是遗漏了什么?
  • 仍然使用62.5%"而不是10px"还有真正的原因吗?
  • 使用62.5%"而不是即使设计被破坏(根据示例)是否有一些好处?

因为对于上面的例子,如果它不能正常工作,我觉得他们为什么要这样做是愚蠢的.

Because as for the example above I feel dumb in understanding why they do that if it doesn't work correctly.

更新 1:
它与 font-size:62.5% vs. font-size:10px.我知道 62.5% 在很多点上等于 10px,我知道有什么区别.我不是在谈论相关的 IE 行为.此外,我对为什么在不需要时使用它很感兴趣.

UPDATE 1:
It's not related to font-size:62.5% vs. font-size:10px. I know so 62.5% is equal to 10px in many points and I know what the difference is. I'm not talking about IE behavior for which is related. Besides, I'm interested why it's used when no need.

请在评论前阅读问题.

  1. 它与缩放无关,看第二个例子,它用作 10px 的魔法点,特别是在缩放时破坏了一切
  2. 它与黄金法则无关,62.5% 用于获得 10px 的基本字体以方便数学

更新 2:
以下是不同默认浏览器字体大小的两个示例的图像.我希望他们能更详细地解释我的意思.

UPDATE 2:
Here are images of both examples on different default browser font size. I hope they explain more what I mean.

很好的例子,正常的默认字体大小(16px):

Good example, normal default font size(16px):

很好的例子,大默认字体大小:

Good example, large default font size:

在这个例子中一切都很好,他们不使用魔法值但完全尊重默认浏览器字体,所以即使字体改变也一切正常.

In this one example everything is fine, they don't use magic value but fully respect default browser font, so everything's alright even when font changes.

不好的例子,正常的默认字体大小(16px):

Bad example, normal default font size(16px):

不好的例子,大默认字体大小:

Bad example, large default font size:

这就是一切都出错的地方,因为他们使用62.5%"来假设它变成10px".但是如果他们只用10px"还是没问题的,那么为什么他们和许多其他人不假思索地仍然使用62.5%"?

And this is where everything goes wrong, cos they used "62.5%" in assuming it to become "10px". But if they only used it as is "10px" all still be fine, so why they and many others still use "62.5%" even without thinking?

推荐答案

开发人员使用它来简化他们的设计.默认字体大小为 16px,因此他们将正文字体大小设置为 62.5%.因此:

Developers use it to make it simple for them to design. The default font size is 16px, so they set the body font size to 62.5%. Therefore:

Body font-size = (62.5/100)*16 = 10px

现在作为人类,我们发现使用十进制系统非常容易.用 10 表示的分数也很容易理解,因此响应式设计变得更容易!

Now as human beings, we find it very easy to use the decimal system. It's also easy to understand fractions in terms of 10, so responsive designing becomes easier!

顺便说一句,我建议您在正文中明确使用 font-size: 10px;,因为所有浏览器默认字体大小可能不是 16px.

By the way, i recommend you use font-size: 10px; explicitly in the body, as all browser default font-size might not be 16px.

希望对我有帮助:)

这篇关于CSS 62.5% 为什么开发者使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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