字体大小 - 转换为实际磅值

发布于 2024-11-05 05:18:16 字数 194 浏览 3 评论 0原文

向大家快速提问:

有谁知道将字体大小设置为以下值时实际的磅值是多少:

  • 大、
  • 较大、
  • 小、
  • X-Large
  • X-Small
  • XX-Large
  • XX-Small

Quick question for everyone:

Does anybody know what the actual point size would be when setting the font-size to the following values:

  • Large
  • Larger
  • Medium
  • Small
  • Smaller
  • X-Large
  • X-Small
  • XX-Large
  • XX-Small

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

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

发布评论

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

评论(5

一个人的夜不怕黑 2024-11-12 05:18:16

此图表解释了字体大小与像素的关系:

在此处输入图像描述

Font sizes to pixels are explained by this chart:

enter image description here

墨落成白 2024-11-12 05:18:16

它可能会因浏览器而略有不同,但在大多数情况下应该有效:

大为 18 px,约为 13.5 pt

较大为 19 px,约为 14 pt

中为 16 px,约为 12 pt

小为 13 px,约为 10 pt

Smaller 为 13 px,约为 10 pt

X-large 为 24 px,约为 18 pt

X-small 为10 px,大约 7.5 pt

XX-large 是 32 px,大约 24 pt

XX-small 是 9 px,大约 7 pt

这是基于查看计算的字体大小样式(以像素为单位)并从 此图表此链接也可能有帮助。

It may vary by browser slightly but for the most part this should work:

Large is 18 px which is around 13.5 pt

Larger is 19 px which is around 14 pt

Medium is 16 px which is around 12 pt

Small is 13 px which is around 10 pt

Smaller is 13 px which is around 10 pt

X-large is 24 px which is around 18 pt

X-small is 10 px which is around 7.5 pt

XX-large is 32 px which is around 24 pt

XX-small is 9 px which is around 7 pt

This is based off of seeing the computed font-size style in pixels and converting from this chart. This link might also be helpful.

愁以何悠 2024-11-12 05:18:16

medium 是用户首选的字体大小。所有其他值均由浏览器定义。 (来源

medium is the user's preferred font size. All other values are defined by the browser. (source)

笑脸一如从前 2024-11-12 05:18:16

如果您能够使用java脚本,那么您可以使用canvas元素测量给定字体大小的高度。大小将返回您指定的字体高度的像素值。仅当用户校准了屏幕时,这才有效:大多数都没有,但对于大多数显示器设置来说,默认值通常很接近。

var cvs = document.getElementById("myCanvas");
var ctx = cvs.getContext("2d");
ctx.font="30px Arial";
var txt="Hello World";
var size = ctx.measureText(txt).height;

If you are able to use java script then you can, using a canvas element, measure the height of a given font size. The size will return a value in pixels for the height of the font you specify. This will only work if the user has calibrated their screen: most have not but the default values are generally close for most monitor setups.

var cvs = document.getElementById("myCanvas");
var ctx = cvs.getContext("2d");
ctx.font="30px Arial";
var txt="Hello World";
var size = ctx.measureText(txt).height;
Smile简单爱 2024-11-12 05:18:16

两个好的网络链接可能会回答这个问题:

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