2012-12-21 32 views

回答

2

您可以随意上传字体,只需要链接到正确的位置即可。请参阅下面的例子,了解CSS中的字体。

@font-face{ 
    font-family:'Your Font Name'; 
    src:url(http://www.example.com/fonts/YourFont.otf); 
} 
+0

所以我的字体被称为(以及它的下载被称为)Capture_it.ttf 如果我想在我的#header中有这个,那么我该怎么办? – FancyAlpha

+0

把这个放在你的CSS文件的顶部......'@ font-face { font-family:'Capture'; src:url(http://www.example.com/fonts/Capture_it.ttf);/*这取决于您上传字体的位置*/ }'.... 然后将其设置在您的标题中---> '#header {font-family:'Capture'}' 请不要如果这有帮助,那么请不要忘记勾选答案。 – dev

+0

src:url是我从哪里获得的网站http://www.fontsquirrel.com/fonts/Capture-it? – FancyAlpha

2

我个人建议使用Font Squirrel Fontface generator。你会得到这样的:

/* @Fontface */ 
    @font-face { 
     font-family: 'Yourfont'; 
     src: url('fonts/yourfont.eot'); 
     src: url('fonts/yourfont.eot?#iefix') format('embedded-opentype'), 
      url('fonts/yourfont.woff') format('woff'), 
      url('fonts/yourfont.ttf') format('truetype'), 
      url('fonts/yourfont.svg#Yourfont') format('svg'); 
     font-weight: normal; 
     font-style: normal; 
    } 

使用这种方式,你会得到一个有效的选项,IE浏览器,铬,歌剧,Firefox和Safari。后来你可以使用这种字体就像一个正常的字体,使用

div.heading { font-family: 'Yourfont', (othersifyouwant); } 
+1

我确实使用它,我从这里得到它:http://www.fontsquirrel.com/fonts/Capture-it 那么,我会如何将它添加到我的CSS和我的#header? – FancyAlpha

+0

您可以使用该文件夹方案,因此首先在您的css文件的文件夹中创建一个名为'fonts'或其他内容的新文件夹。并在那里放置你的字体/字体文件。 然后,添加已配置字体的@ font-face代码,并设置 #header {font-family:Yourfont; } – Tunnecino

相关问题