CSS教程
CSS进阶

CSS line-height

CSS line-height

CSS line-height属性用于 定义元素中线框的最小高度 。它设置内容的两行之间的差异。
它定义内联元素上方和下方的空间量。它允许您独立于字体大小设置行的高度。

CSS行高值

有些属性值与 CSS 行高属性。
说明
normal 这是默认值。它指定法线高度。
number 它指定一个数字,该数字与当前字体大小相乘以设置行高。
length 用于以px,pt,cm等设置行高。
它以当前字体的百分比指定行高。
initial 它将此属性设置为其默认值。
inherit 它从其父元素继承了此属性。

CSS行高示例

<!DOCTYPE html>
<html>
<head>
<style>
h3.small {
    line-height: 70%;
}
h3.big {
    line-height: 200%;
}
</style>
</head>
<body>
<h3>
This is a heading with a standard line-height.<br>
This is a heading with a standard line-height.<br>
The default line height in most browsers is about 110% to 120%.<br>
</h3>
<h3 class="small">
This is a heading with a smaller line-height.<br>
This is a heading with a smaller line-height.<br>
This is a heading with a smaller line-height.<br>
This is a heading with a smaller line-height.<br>
</h3>
<h3 class="big">
This is a heading with a bigger line-height.<br>
This is a heading with a bigger line-height.<br>
This is a heading with a bigger line-height.<br>
This is a heading with a bigger line-height.<br>
</h3>
</body>
</html>
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4