Html CSS:Helvetica 是 Mac 上的默认“sans-serif”字体,Arial 是 Windows 上的默认 sans-serif 字体吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1631098/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 01:08:24  来源:igfitidea点击:

CSS: Is Helvetica the default 'sans-serif' font on Mac and Arial the default sans-serif font on Windows?

htmlcss

提问by Teddi

I have a lot of CSS that does the following:

我有很多 CSS 执行以下操作:

font-family: Helvetica, Arial, sans-serif;

It my understanding that Helvetica is the default sans-serif font on Mac and Arial is the default sans-serif font on Windows ... if that's the case, couldn't I just change the above code to be:

我的理解是 Helvetica 是 Mac 上的默认 sans-serif 字体,Arial 是 Windows 上的默认 sans-serif 字体......

font-family: sans-serif;

Yes, no?

是,不是?

回答by Samir Talwar

The default font really depends on the browser. For example, in Firefox on Mac, I have Lucida Grande as the default sans-seriffont. I don't think I changed it, but I'm not entirely sure. You can't really depend on the defaults being specific fonts, as users can change them in the preferences. If you want a specific font, specify it.

默认字体实际上取决于浏览器。例如,在 Mac 上的 Firefox 中,我将 Lucida Grande 作为默认sans-serif字体。我不认为我改变了它,但我不完全确定。您不能真正依赖于特定字体的默认设置,因为用户可以在首选项中更改它们。如果您想要特定字体,请指定它。

回答by Thomas Edwards

Helvetica on Windows XP looks horrible due to its poor rendering. Luckily, only a few people have Helvetica installed on Windows XP (because if they care about Helvetica, they'll probably be using a Mac).

由于渲染不佳,Windows XP 上的 Helvetica 看起来很糟糕。幸运的是,只有少数人在 Windows XP 上安装了 Helvetica(因为如果他们关心 Helvetica,他们可能会使用 Mac)。

This is safer:

这样更安全:

"Helvetica Neue", Arial, sans-serif;

That way, pretty much only Mac OS X will pickup Helvetica Neue (standard on OS X) and Windows can ignore it and move straight into Arial.

这样,几乎只有 Mac OS X 会选择 Helvetica Neue(OS X 上的标准),而 Windows 可以忽略它并直接进入 Arial。

回答by Tom

With fonts, you want to be as specific as possible to prevent layout issues. Your page may look perfect on a machine with Arial as the default sans-serif font, but if someone has a very different font as their default, it can affect spacing of elements (if you use relative measures). Plus it makes any designer on the project angry when they see the wrong font, and you don't want that.

对于字体,您希望尽可能具体以防止出现布局问题。您的页面在使用 Arial 作为默认 sans-serif 字体的机器上看起来可能很完美,但是如果有人使用非常不同的默认字体,它会影响元素的间距(如果您使用相对度量)。此外,当项目中的任何设计师看到错误的字体时,他们都会生气,而您不希望那样。

回答by Joachim Sauer

What do you want to happen on platforms that have

您希望在具有以下功能的平台上发生什么

  • Helvetica or Arial installed and
  • a default sans-serif font that is neither of those?
  • 已安装 Helvetica 或 Arial
  • 默认的 sans-serif 字体,两者都不是?

Or asked differently: do you always prefer Helvetica or Arial over the default, if they are installed? If you prefer the default sans-serif font in all cases, why mention those two at all?

或者换个方式问:如果安装了 Helvetica 或 Arial,您是否总是喜欢默认的 Helvetica 或 Arial?如果您在所有情况下都更喜欢默认的 sans-serif 字体,为什么要提到这两个呢?

回答by Foo Bar

Helvetica is sometimes the default sans on Mac, but to be honest it's not a great screen font.

Helvetica 有时是 Mac 上的默认字体,但老实说,它并不是一种很棒的屏幕字体。

Geneva, Lucida Sans, and Trebuchet MS are good alternatives.

日内瓦、Lucida Sans 和 Trebuchet MS 是不错的选择。

回答by mensch

You can be pretty certain that Helvetica is installed on machines running Mac OS X, because that font is used in a number of official applications designed by Apple. Arial is also available on any machine, provided that the user hasn't deleted the font file.

您可以非常确定 Helvetica 安装在运行 Mac OS X 的机器上,因为 Apple 设计的许多官方应用程序中都使用了这种字体。Arial 也可以在任何机器上使用,前提是用户没有删除字体文件。

But as Tom points out, it's better to be as specific as possible when defining font styles. When I want a sans-serif family displayed I usually have the following in my stylesheets:

但正如 Tom 指出的那样,在定义字体样式时最好尽可能具体。当我想要显示 sans-serif 系列时,我的样式表中通常包含以下内容:

Helvetica, Geneva, Arial, sans-serif;