【发布时间】:2016-12-05 16:38:19
【问题描述】:
我在使用自定义字体(poppins-regular.ttf)时遇到问题。问题是当我为作为文本包装的 span 标签设置背景颜色时。
像 g,y,.. 这样的词在底部被剪掉了。但是,如果我将字体系列从 poppinsRegular 更改为 tahoma,它看起来不错。
但这里真正的问题是我需要保持相同的行高
.passageBody, .passageBody2 {
width: 414px;
padding: 10px 0;
margin: 0px;
font-size: 24px;
line-height: 32px;
font-family: 'Poppins', sans-serif;
}
.passageBody2 {
font-family: tahoma;
}
.highlightPhrase {
background-color: yellow;
}
<link href="https://fonts.googleapis.com/css?family=Poppins" rel="stylesheet">
<div class="passageBody">
<span>“Good-bye to you and your funny feet.</span>
<span class="highlightPhrase">Thanks for all the eggs to eat!” I was speaking to Bess, our chicken, and Mother laughed.</span>
</div>
<hr/>
<div class="passageBody2">
<span>“Good-bye to you and your funny feet.</span>
<span class="highlightPhrase">Thanks for all the eggs to eat!” I was speaking to Bess, our chicken, and Mother laughed.</span>
</div>
【问题讨论】:
-
我记得,行高不需要像 px 这样的单位。就放 1.2 1.5 否则
-
谢谢@obink,我给了行高 1.3,它仍然显示同样的问题
-
我认为 Poppins 字体的设计行高有问题。我在我们的网站上使用这种字体,虽然我正在更改行高,但它并没有完全显示。