使用 CSS 修复自定义字体行高 [英] Fix custom font line-height with CSS

查看:28
本文介绍了使用 CSS 修复自定义字体行高的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我正在开发的新网络应用上使用自定义字体时,我遇到了一个奇怪的问题.

I've been experiencing a strange issue when using a custom font on a new webapp i'm working on.

这种自定义字体 (FF DIN) 似乎具有自然的垂直偏离中心的行高,这迫使我进行一些填充顶部 hack 以补偿按钮和输入等元素的顶部空间.

This custom font (FF DIN) Seem to have naturally vertical off-center line-height, which force me to put some padding-top hack to compensate the top space on element like button and input.

示例:绿色字体 (Helvetica Neue) 正确对齐,其中我们使用的自定义字体 (FF DIN) 垂直偏离中心:

是否有任何已知的方法可以自然地解决 CSS 上的居中问题,以某种方式强制字体基线行为?

Is there any known way to fix that centering issue on the CSS naturally, someway to forces font baseline behavior?

谢谢.

推荐答案

最后,我最终自己手动修复了字体,使用此答案的帮助:

In the end, I've end up manually fixing the font myself, using help from this answer:

UIButton 自定义字体垂直对齐

这篇关于使用 CSS 修复自定义字体行高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆