标签:
base都是font-size,不管是继承的,还是自身的。
"%":为继承父元素的距离
"无单位":计算各自的距离。
看demo1:
样式
body{
font-size: 14px;
line-height: 150%;
}
#p1{
font-size: 12px;
}
结构:
<body> <p id="p1">我是个好人</p> </body>
然后通过
console.log($("#p1").css("line-height"));
获取到p的行高为21.
demo2:
样式:
.box{
font-size: 12px;
line-height: 1.5;
}
#p2{
font-size: 16px;
}
结构:
<div class="box">
<p id="p2">猪猪猪猪猪猪</p>
</div>
然后通过
console.log($("#p2").css("line-height"));
获取到p的行高为24.
line-height:150%和line-height:1.5的区别
标签:
原文地址:http://www.cnblogs.com/yansj1997/p/4955828.html