首先,让我们看一段代码:
div { width:200px; height:200px; border:1px solid black; line-height:200px; }
span { line-height:1.7; }
<div><span>123<br>456<br>789<br>000</span></div>
Why is the span
's line-height
unused?
The line-height
is still 200px
, but when we set span
's display
property to inline-block
, the line-height
of the span
is used?
See below:
div { width:200px; height:200px; border:1px solid black; line-height:200px; }
span { display:inline-block; line-height:1.7; }
<div><span>123<br>456<br>789<br>000</span>