我正在努力实现的空间周围变成10px
。但我要求在这里使用双倍的线高。我没有得到平等的空间。正确的方法是什么?我在左右两边都得到了它。但不是顶部和底部。
null
*{
padding:0;
margin:0;
}
div{
background:yellow;
padding:10px;
}
div p {
line-height: 2;
text-align:justify;
}
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad dolores laborum voluptates nobis vero minima corporis, magnam officia asperiores repudiandae at voluptatibus, iste deserunt. Nam, provident architecto? Minus, repellat, veniam!</p>
</div>
null
从衬垫顶部和底部移除一半的线高
null
*{
padding:0;
margin:0;
}
div{
background:yellow;
padding:calc(10px - 1em) 10px;
}
div p {
line-height: 2em; /* will give the same result as 2 */
text-align:justify;
}
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad dolores laborum voluptates nobis vero minima corporis, magnam officia asperiores repudiandae at voluptatibus, iste deserunt. Nam, provident architecto? Minus, repellat, veniam!</p>
</div>