查看下面的跨度:
<div style=" position:absolute; top:37.6pt; left:0.8pt; background-color:; border:0pt solid black; width:234pt;">
<div align="left" ><span style=" white-space:pre-wrap; font:normal 8pt Arial; color:rgb(0,0,0);">Your statement shows claims for medical care only after we've received and processed the claim. The claim in question may not have been received yet or it may not be finalized. There may be instances where your claims are not showing up because Health Statements have recently been added to your plan.</span></div>
</div>
默认情况下,Span 显示的行间距太大,我想将行间距设置为如下文本所示:
<div style=" position:absolute; top:37.6pt; left:0.8pt; background-color:; border:0pt solid black; width:234pt;">
<div align="left" ><div style=" white-space:pre-wrap; font:normal 8pt Arial; color:rgb(0,0,0);">Your statement shows claims for medical care only after we've received and processed the claim. The claim in question may not have been received yet or it may not be finalized. There may be instances where your claims are not showing up because Health Statements have recently been added to your plan.</div></div>
</div>
我面临的限制是我不能使用“div”而不是 span,我也不能使用“display”属性,所以有什么方法可以在没有 display 属性的情况下减少 span 中的行间距。理想情况下是“line” -height"属性,但这似乎不起作用..
最佳答案
ideally "line-height" property, but that doesn't seem to work..
如果您不在跨度上设置行高,而是在父容器上设置行高,我会工作:
<div style="width: 400px;">
<div align="left" style="line-height: .4em;">
<span style="white-space: pre-wrap; font: normal 8pt Arial;">Your statement shows claims for medical care only after we've received and processed the claim. The claim in question may not have been received yet or it may not be finalized. There may be instances where your claims are not showing up because Health Statements have recently been added to your plan.</span>
</div>
</div>
UPD. @sai kumar 发现了有关 CSS 规则顺序重要性的有趣细节。为了 line-height
在 span 上工作,它应该放在 font
属性之后。顺序在这里很重要,因为 font
是一个组合属性,其中还包含 line-height
。因此在这种情况下,在 line-height
之后定义的 font
将使用默认值 line-height: normal
覆盖它。
关于html - 减少跨度中的行间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28298034/