使用 CSS 设置行高
cssweb developmentfront end technology更新于 2024/11/28 23:40:17
要设置行高,请使用 line-height 属性。以下是属性值 −
line-height: normal|number|length|initial|inherit;
示例
现在来看一个例子 −
<!DOCTYPE html>
<html>
<head>
<style>
div {
line-height: 1.9;
}
</style>
</head>
<body>
<h1>Demo Heading</h1>
<div>
<p>This is demo text.<br>
This is another demo text.
</p>
</div>
</body>
</html>
输出

示例
现在让我们看另一个例子 −
<!DOCTYPE html>
<html>
<head>
<style>
div {
line-height: 200%;
}
</style>
</head>
<body>
<h1>Demo Heading</h1>
<div>
<p>This is demo text.<br>
This is another demo text.
</p>
</div>
</body>
</html>
输出

相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

