Html 如何增加CSS中的行间距?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1114156/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 00:13:31  来源:igfitidea点击:

How to increase spacing between lines in CSS?

htmlcss

提问by User

I have something similar to that:

我有类似的东西:

<table>
    <tr>
        <td>Hello,<br/>World!</td>
    </tr>
</table>

Both lines

两条线

Hello,
World!

are displayed too close to one another. Any way to increase spacing between them (by a portion of a line width (without another <br/>))?

彼此显示得太近。有什么方法可以增加它们之间的间距(通过线宽的一部分(没有另一个<br/>))?

回答by RichieHindle

Here's a full example of how to make the line spacing within <td>s one and a half times the height of the font:

这是一个完整的示例,说明如何使<td>s内的行距为字体高度的一倍半:

<html><head>
<style>
td {
    line-height: 150%;
}
</style>
</head>
<body>
<table>
    <tr>
        <td>Hello,<br/>World!</td>
    </tr>
</table>
</body></html>

回答by Gumbo

Use line-heightto adjust the, well, line height. So in your case line-height: 2will double the line height.

使用line-height调整,好了,行高。所以在你的情况下line-height: 2会使行高加倍。

回答by Aiden Bell

td {
    line-height:<value>;
}