我是使用@font-face 渲染字体的新手。我在设计中使用 Gill Sans 字体系列。
我做了研究以了解如何让它为我工作,但我无法理解如何使用它。我使用的字体类型没有 .eot
和 .woff
字体类型。我只能在我的字体文件夹中看到 gill sans font true type 字体。
我想看看是否有人可以帮助理解它是如何工作的,并让我更容易使用它。 我无法理解以下代码中发生的事情。
@font-face {
font-family: 'MyWebFont';
src: url('webfont.eot'); /* IE9 Compat Modes */
src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('webfont.woff') format('woff'), /* Modern Browsers */
url('webfont.ttf') format('truetype'), /* Safari, Android, iOS */
url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}
最佳答案
不幸的是,不同的浏览器需要不同格式的字体。您可以从此处的 .ttf 文件生成其他格式:
http://www.fontsquirrel.com/tools/webfont-generator
然后您可以使用您定义的名称 (MyWebFont) 在 CSS 中使用您的字体。
body {
font-family: MyWebFont;
}
关于html - 使用@font-face 呈现 Gill Sans 字体系列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18806975/