[HTML] 纯文本查看 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>测试下line-height</title>
</head>
<body>
<style>
div {
outline: 1px solid #f80;
margin: 3em;
padding: 2em;
font-size: 13px;
}
div h1 {
color: #f80;
padding-bottom: .5em;
border-bottom: 1px solid #f80;
}
/* 下面是正题 */
div p {
font-size: 2em;
}
.use-em {
line-height: 1.5em;
}
.use-percent {
line-height: 150%;
}
.use-number {
line-height: 1.5;
}
</style>
<div class="use-em">
<h1>* em</h1>
<p>这里,我们会发现,三类值中各有“相对值”的定义方式,百分比和数字值本身就是“相对值”,单位值中,em/rem等也是“相对值”。撇开rem不看,em/百分比/数字值都是相对于“font-size”值的,比如</p>
</div>
<div class="use-percent">
<h1>* 百分比</h1>
<p>这里,我们会发现,三类值中各有“相对值”的定义方式,百分比和数字值本身就是“相对值”,单位值中,em/rem等也是“相对值”。撇开rem不看,em/百分比/数字值都是相对于“font-size”值的,比如</p>
</div>
<div class="use-number">
<h1>* 数字值</h1>
<p>这里,我们会发现,三类值中各有“相对值”的定义方式,百分比和数字值本身就是“相对值”,单位值中,em/rem等也是“相对值”。撇开rem不看,em/百分比/数字值都是相对于“font-size”值的,比如</p>
</div>
</body>
</html>