2015-08-14 80 views
1

我用这个代码来实现个性化字体:@字体面不工作的Chrome或Safari

CSS

 @font-face{ 
    font-family:'playtime'; 
    src: url('../fonts/font-1.otf') format('opentype'); 
    } 
    p.playtime-font { 

    font-family: 'playtime', Verdana, Arial, Helvetica, sans-serif; 
    font-size: 3em; 
} 

HTML

<div class="texto-horario"> 
     <p class="playtime-font">Horario</p> 
    </div> 

但它不工作,我已经在Chrome和Safari上试过了,并且什么都没有... 我不知道我在做什么错误,请任何人都可以帮助我?

+0

它可以在任何其他浏览器上工作吗?或者你只是说你尝试过的只有Chrome和Safari? – Parker

+0

另外,请添加您尝试应用字体的元素的HTML,它可能是一个小的错字类型问题 – Parker

+0

@Parker我只尝试过Chrome和Safari,因为我认为这些是最常用的浏览器 –

回答

2

尝试没有单引号:

@font-face{ 
    font-family: playtime; 
    src: url('../fonts/font-1.otf') format('opentype'); 
    } 
    p.playtime-font { 
    font-family: playtime; 
    font-size: 3em; 
} 

如果这不起作用,则您的控制台说什么?

+2

谢谢!它的工作完美无需使用引号:) –

+0

不用担心,很高兴我能帮上忙。 –

相关问题