网页制作 发布日期:2025/11/3 浏览次数:1
Line-height的如何继承?
核心代码演示:
初始化
<style>
body{
font-size: 20px;
}
p {
background-color: #ccc;
font-size: 16px;
}
</style>
</head>
<body>
<p>这是一行文字</p>
</body>
写具体数值
body{
font-size: 20px;
line-height: 50px;
}
p {
background-color: #ccc;
font-size: 16px;
}
写比例
body{
font-size: 20px;
line-height: 1.5;
}
p {
background-color: #ccc;
font-size: 16px;
}
写百分比 先算后继承!
body{
font-size: 20px;
line-height: 200%;
}
p {
background-color: #ccc;
font-size: 16px;
}