CSS 字体系列在 Windows 和 Mac OS X 上的显示方式不同
由于某种原因,以下两个代码片段在 Mac OS X 上显示正确,但在 Windows 上完全被忽略,即字体恢复为具有默认大小和边距的 Times New Roman。知道为什么会这样吗?
body {
font-family: "Helvetica Neue", "Lucida Grande", "Sans serif";
}
#div h1, p {
margin: 0px;
font-size: 14px;
color: #333;
}
For some reason, the following two code snippets display correctly on Mac OS X but are completely ignored on a Windows i.e. the font reverts to Times New Roman with default sizes and margins. Any idea why this could be?
body {
font-family: "Helvetica Neue", "Lucida Grande", "Sans serif";
}
#div h1, p {
margin: 0px;
font-size: 14px;
color: #333;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
它是带有破折号的无衬线字体。前两种字体可能没有安装在 Windows PC 上(我没有)。
It's sans-serif with a dash. The first two fonts are probably not installed on the Windows PC (I don't have them).
尝试这样的事情:
try something like this:
根据
font-family
属性,计算机尝试查找 Helvetica Neue、Lucida Grande 和 Sans serif 字体。但是,PC 没有安装 Helvetica Neue 或 Lucida Grande 字体,并且无法找到后备字体
Sans serif
,因为浏览器默认为sans-serif
,一个词,不带引号。建议您尝试添加更多可在 Windows 计算机上找到的无衬线字体,例如
Lucida Sans
,这样它看起来就不会像糟糕的默认无衬线字体Arial
。您的边距和字体大小应该可以再次使用,但我建议您将
font-size: 14px;
更改为font-size: 1em;
或font-size: 100%;
以允许用户在不破坏布局的情况下缩放字体。这是你的修复方法:
According to the
font-family
attribute, the computer's trying to find the fonts Helvetica Neue, Lucida Grande, and Sans serif.However, the PC doesn't have the fonts Helvetica Neue or Lucida Grande installed, and it can't find the fallback font
Sans serif
because the browser default issans-serif
, one word, with no quotation marks.As a suggestion, you should try adding more sans-serif fonts that can be found on Windows machines, such as
Lucida Sans
so it doesn't look like the terrible default sans-serif fontArial
.Your margins and font sizes should work again, though I suggest that you change
font-size: 14px;
tofont-size: 1em;
orfont-size: 100%;
to allow users to scale the font without destroying the layout.Here's your fix: