css - 禁用字体连字 CSS(字母组合)

标签 css google-chrome fonts

现代浏览器会自动将一些字母(最常见的是“f”和“i”)组合成一个称为连字的字符。这通常会优化易读性(即更易于阅读),但有时这可能不是设计师想要的。

就我个人而言,我只在 Chrome(版本 53.0.2785.101)中遇到过这个问题,虽然我不能确定,但​​我相信这个问题在所有其他版本的 Chrome 中仍然存在。

Chrome Sample text in Chrome fi 组合多次

边缘 Sample text in Edge

IE11 Sample text in IE

在这种情况下,我正在寻找一种方法将其关闭。

最佳答案

事实证明,这绝对是可能的,只是需要进行一些挖掘。正如在 MDN, you can turn off common ligatures 中提到的:

font-feature-settings: "liga" 0;

然而,这是通过使用一个晦涩的 css 属性来完成的。相反,您应该使用 font-variant-ligatures,如下所示:

font-variant-ligatures: none;

这两个属性的作用完全相同,但是,推荐使用后一个。

MDN:

Note: Whenever possible, Web authors should use the font-variant shorthand property or an associated longhand property, font-variant-ligatures, font-variant-caps, font-variant-east-asian, font-variant-alternates, font-variant-numeric or font-variant-position.

This property is a low-level feature designed to handle special cases where no other way to enable or access an OpenType font feature exists.

In particular, this CSS property shouldn't be used to enable small caps.

关于css - 禁用字体连字 CSS(字母组合),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39504775/

相关文章:

CSS 媒体查询被忽略

html - 如果 % height 是基于父宽度,为什么当页面变窄时 div 不会变短?

jquery - Chrome Bug 选择/显示

java - 从 Web 应用程序以 PDF 格式部署 jasperreport 时字体不起作用

在 react 路由器中找不到嵌套路由的字体

css - Internet Explorer 11 和支持的网络字体

html - 如何用纯css创建一个十字架

javascript - 在 Javascript 和 HTML 中显示图像

javascript - 有没有办法在 Chrome 中使用 HTML 来更改 Android 中的导航栏颜色?

javascript - 打开窗口并立即关闭