关于css:css图文样式-lineheight如何继承

4次阅读

共计 325 个字符,预计需要花费 1 分钟才能阅读完成。

css 款式

body{
   font-size:20px;
   line-height:30px;
}
p{
   background:#ccc;
   font-size:16px;
}

html

<body>
  <p> 这是一段文字 </p>
</body>

注解:~~~~

  1. 如果 body 元素中 line-height:30px; 则 p 元素 line-height:30px;
  2. 如果 body 元素中 line-height:1.5; 则 p 元素 line-height:24px;(p 元素的 font-size 乘 body 元素的 line-height)
  3. 如果 body 元素中 line-height:200%; 则 p 元素 line-height:40px; (body 元素的 font-size 乘 body 元素的 line-height)
正文完
 0