问题描述
根据( a在指定 font-family
名称某些操作系统/浏览器可能 时,源代码通常高度信任 区分大小写。。
According to sitepoint (a source I typically highly trust) when specifying font-family
names some Operating Systems/Browsers may be case-sensitive.
我通常使用混合大小写值,但我想知道小写值是否只能同样?
I've typically always used mixed-case values but I'm wondering if lower-case values will work just the same?
我没有一个压倒性的偏好 - 但我讨厌一个页面渲染不同,因为我打字小写v
与V
在某个CSS文件中。
I don't have an overwhelming preference either way - but I'd hate for a page to render differently because I typed a lower-case "v"
vs. "V"
somewhere in a CSS file.
例如有没有任何已知的情况下,与下面的 foo
和 bar
类的2个div实际上将使用不同的字体? / p>
e.g. are there any known cases where 2 divs with the foo
and bar
classes below would actually render with a different font?
div.foo{
font-family:Verdana, Arial, Helvetica;
}
div.bar{
font-family:verdana, arial, helvetica;
}
推荐答案
/ em>是,这只会是Linux / Unix系统上的潜在问题,其中文件系统区分大小写。我会惊讶,如果任何Windows浏览器有这个问题,因为字体只是C:\Windows \Fonts目录中的文件。
My guess is that this would only be a potential problem on Linux/Unix systems, where the file system is case sensitive. I'd be surprised if any Windows browser had a problem with this, since fonts are just files in the C:\Windows\Fonts directory.
你可以尝试使用可识别的字体(如Courier New)制作包含测试文本的网页,但拼写有趣的CoUrIEr nEW,然后转到,它将从多个浏览器生成屏幕截图。
You could try making a page with test text in a recognizable font like Courier New, but spell it funny like "CoUrIEr nEW", then go to http://browsershots.org/ where it will generate screenshots from tons of browsers. Be sure to make the font very large too, because the screenshots are small.
这样的东西:
<html>
<head>
<style type="text/css">
#proper { font: bold 48px "Courier New",Courier; }
#improper { font: bold 48px "CoUrIEr nEW",CoUrIEr; }
</style>
</head>
<body>
<p id="proper">Test1 - proper caps</p>
<p id="improper">Test2 - improper caps</p>
</body>
</html>
如果在Courier中只显示一行敏感。
If only one line shows up in Courier, then that browser is case sensitive.
编辑:我测试了我在浏览器快照中发布的HTML。我没有找到任何没有工作的浏览器。 Dillo 2.1.1对于Ubuntu Linux不喜欢任何一行(也许该系统缺少Courier New和Courier?),所有其他人都在Courier或Courier New中显示了两行。仍然有移动浏览器,但没有测试,所以你应该努力使用正确的大小写,以防万一。
Edit: I tested the HTML I posted above in browsershots. I didn't find any browser that didn't work. Dillo 2.1.1 for Ubuntu Linux didn't like either line (maybe that system lacked both Courier New and Courier?), all others showed both lines in Courier or Courier New. There are still mobile browsers that were not tested, though, so you should strive to use proper capitalization just in case.
这篇关于在哪些操作系统或浏览器上的CSS字体系列名称区分大小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!