html - css:如何在不增加整个文本行高的情况下增加一个字符的字体大小?
问题描述
我有一个来自其他的符号font-family
,需要调整它的大小。不幸的是font-size:200%
增加了整行的行高;
如何在font-size
不增加的情况下增加一个字符line-height
?
我知道“切断”字符,position:absolute
但这也会水平移动文本。当我想要的东西是线line-height: inherit
(不起作用)时。
.increased {
font-size:200%
}
<p>normal</p>
<div style="background-color:yellow">.text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text </div>
<p>increased (problematic)</p>
<div style="background-color:yellow"> <span class="increased">.</span>text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text </div>
解决方案
如果您确定它不是该行中的唯一字符,则可以使用line-height: 0
. 否则,您将不得不手动调整line-height
值。
.increased {
font-size: 200%;
line-height: 0
}
<p>normal</p>
<div style="background-color:yellow">.text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text </div>
<p>increased (problematic)</p>
<div style="background-color:yellow"> <span class="increased">.</span>text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text </div>
推荐阅读
- endpoint - 艾玛迪斯最便宜的日期 REST 端点不起作用
- vba - 在循环内动态更改列
- python - 以日期格式存储日期时间,使用 Pymongo 烧瓶
- gradle - 无法获得分类依赖
- c# - SonarQube:新版本 (7.2) 未分析 C# 文件
- java - 如何从 GUI 的 Enter 按钮中获取更多代码?
- guava - 为什么 Guava StandardTable put 方法拒绝空值
- swagger - Swashbuckle.AspNetCore 3.0 的更新不再按标签分组
- javascript - JS:Lint 错误:意外的令牌 =
- rspec - 评论模型的 Rspec 测试(验证失败:用户必须存在)