高度对线宽设计 [英] height vs line-height styling
问题描述
在处理不会超过一行的文本时,使用这两个字符之间有什么区别?他们都可以在屏幕上产生类似的结果,从我可以看到的元素顶部或底部的元素。为什么使用行高如果是这样?高度将使用更有意义。
What is the difference between using these two when dealing with text that will never be more than a single line? They both can produce similar results on the screen from what I can see in regards to the elements on top or on the bottom of the element. Why use line-height at all if so? Height would make more sense to use.
编辑:这是一个从带有文本内部的div创建的风格化按钮的示例。这将永远不是多线的。因此,为了兼容性原因,行高是否需要?或任何我不知道的?
An example of this a stylized button created from a div with text inside. This will never be multiline. So would line-height be needed for compatibility reasons? or anything I don't know about?
谢谢!
推荐答案
/ code>是容器的垂直尺寸。
height
is the vertical measurement of the container.
line-height
如果只使用一行文本,我期望他们产生类似的结果在大多数情况下。
If used with only one line of text I'd expect them to produce similar results in most cases.
当我要显式设置容器大小和 height
> line-height 用于排版布局,如果用户调整文本大小,则可能是相关的。
I use height
when I want to explicitly set the container size and line-height
for typographic layout, where it might be relevant if the user resizes the text.
这篇关于高度对线宽设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!