カスタムフォント(poppins-regular.ttf)を使用しているときに問題が発生しました。問題は、テキストのラッパーであるspanタグの背景色を設定したときです。解決方法HTMLのカスタムフォントで行の高さの問題?
g、y、..などの単語が下に切れています。しかし、フォントファミリをpoppinsRegularからtahomaに変更すると、それはよさそうです。ここ
しかし、本当の問題は、私はあなたが行の高さプロパティを削除するか、try to setするか、同じ行の高さ
.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>
を試してみて、行の高さをピクセルなどの単位を必要としません。ちょうど1.2を置く1.5またはそうでなければ – Obink
ありがとう@obink、私は行の高さ1.3を与え、それは同じ問題をまだ示します –
私はポピンズフォントは、デザインの行の高さに問題があると思います。私はこのフォントをウェブサイトに使用していますが、行の高さを変更しているにもかかわらず正確には表示されません。 – huykon225