我可以根据字体可用性设置字体大小吗?

发布于 2024-12-21 13:12:11 字数 284 浏览 3 评论 0原文

是否可以根据字体可用性设置不同的字体大小?

目前我的问题是 Verdana 太大,如果用户没有安装 Verdana,我最终会得到一个非常小的字体大小

是否有将字体(在我的例子中为 Verdana)设置为 13px 的方法,如果用户没有安装该字体,请尝试使用其他字体(例如 Arial),但使用更大的字体大小?

注释:

  • 最好只
  • 允许 CSS CSS hacks

Is it possible to set a different font-size according to font availability?

Currently my problem is that Verdana is too big, and if the user don't have Verdana installed, I will end up with a very small font-size

Is there is any way to set a font (Verdana in my case) to 13px and if the user don't have that font installed, try with another font (Arial for example) but with bigger font-size?

Notes:

  • Preferably CSS only
  • CSS hacks allowed

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

幸福丶如此 2024-12-28 13:12:11

正如其他人在一分钟前回答的那样(但已经删除?),您可以使用 字体检测器 JavaScript 解决方案:

http://jsfiddle.net/FHnJw/1

As was answered just a minute ago by someone else (but already deleted?), you could use Font Detector Javascript solution:

http://jsfiddle.net/FHnJw/1

别闹i 2024-12-28 13:12:11

这可能需要一些工作来实现(我自己实际上还没有这样做过),但似乎 font-size-adjust 属性通过标准化 x 高度来帮助“均衡”字体。请参阅http://www.w3.org/TR/css3 -fonts/#propdef-font-size-adjust 获取官方说明。

This might take some work to implement (I have not ever actually done it myself), but it seems that the font-size-adjust property helps "equalize" font's by standardizing the x-height. See http://www.w3.org/TR/css3-fonts/#propdef-font-size-adjust for the official description.

大姐,你呐 2024-12-28 13:12:11

字体大小调整仅适用于 Firefox

独立的“font”css 声明仅允许您在连续声明不同的字体系列之前声明一次字体大小、样式和粗细,所以这是不行的

我很遗憾地说无法单独通过 css 完成

至于 JS 替代方案,这是我推荐的替代方案:

http://www.lalit.org/lab/javascript-css-font-detect/

祝你好运

Font-size adjust only works with Firefox

The standalone 'font' css declaration only allows you to state font-size, style and weight once before declaring the different font families in succession so that's a no-go either

I'm sorry to say this cannot be done through css alone

As for the JS alternative, here's the one I recommend:

http://www.lalit.org/lab/javascript-css-font-detect/

Good luck

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文