为什么浏览器预留空间,重音符号,即使没有一个? [英] why browsers reserve space for ACCENTED CHARACTERS even if there is not one?

查看:92
本文介绍了为什么浏览器预留空间,重音符号,即使没有一个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

参考:

我的问题是关于交代社区成员在这一问题<给定href=\"http://stackoverflow.com/questions/20119878/how-to-remove-space-at-top-of-p-tag-align-contained-text-to-top-of-container/20119976#comment29982436_20119976\">How在顶部和LT除去空间; P&GT;标签/对齐包含文本容器的顶部?。


我想知道的是,是,假设我的&LT; P&GT; 或任意其它标记不包含任何这样的字符,如 A C 那么为什么浏览器储备为它的空间(是否保留一个空格....?因为我不知道了,刚准备在解释线在所列出的问题)......

渲染的浏览器中有哪些标记和CSS被赋予.... 如果没有在code重音字符,为什么空间有没有它,然后??


解决方案

这是完全由字体。见例子有问题的截图:

突出显示的排版的行高是包含的元素(浅蓝色)完全齐平。这封信根本不舒展一路攀升到最大可用高度,一样的,因为它不向下延伸低于基线的所有道路。

它是由一个字体离开高于或低于信,这是典型的做法到preserve字体面,其包括可以是更高的字母的整体视觉平衡空间的创建者。参见例如:


  

AA


如果在A将一路绵延到最大可用高度,A来表示就不是比身高较高或需要被压扁了。因为这看起来蹩脚的,正规的A是不一样高,因为它可能会如此既A可以是相同的视觉。

它无关,与是否实际上正在使用重音字母与否,字形不是动态的基础上重新调整内容。他们总是相同的高度,这是由该字体创建者设置的。如果你有此段文字:


  

AAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA结果
  AAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA结果
  AAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA结果
  AAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA


如果信件大小将动态变化的基础上是否需要额外的空间与否,这将给一个外观极不平衡。这就是为什么它没有被完成。

Reference :
My questions is in regard to explaination given by community members in this question How to remove space at top of <p> tag / align contained text to top of container?.

Question

What i want to know is, that,assuming my <p> or any-other markup doesn't contain any such characters, like Ä or Ĉ then why would browser reserve a space for it (does it reserves a space....?? since i don't know, m just going in line of explanation in the quoted question)....

browsers render what has been given in the markup and the CSS....if there is no accented character in the code, why is a space there for it then??

解决方案

This is entirely up to the font. See the screenshot of the example in question:

The line height of the highlighted "Lorem" is perfectly flush with the containing element (light blue). The letter simply doesn't stretch all the way up to the maximum available height, just the same as it doesn't stretch all the way down below the baseline.

It is up to the creator of a font to leave space above or below a letter, which is typically done to preserve the overall visual balance of the font face which includes letters which may be taller. See for example:

If the "A" would be stretching all the way to the maximum available height, the "Ä" next to it would either be taller than tall or would need to be squished down. Since this looks crappy, the regular "A" is not as tall as it possibly could be so both "A" can be the same visually.

It has nothing to do with whether you're actually using accented letters or not, glyphs are not rescaled dynamically based on content. They're always the same height, which is set by the font creator. What if you had this block of text:

AAAAAAAAAAAAAAAAAAA ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ AAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAA ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ AAAAAAAAAAAAAAAAAAA

If the letter size would dynamically change based on whether you "need extra space" or not, this would give an extremely uneven appearance. Which is why it's not being done.

这篇关于为什么浏览器预留空间,重音符号,即使没有一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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