简体   繁体   English

CSS字体无法正常工作

[英]CSS Font face not working

Hey Ya'll my CSS font face is not working, I have no idea why, it was working a few days ago... 嘿Ya我的CSS字体表面不起作用,我不知道为什么,它几天前工作了......

Here is the CSS 这是CSS

@font-face {
    font-family: 'TrajanProBold';
    src: url('trajanpro-bold-webfont.eot');
    src: url('trajanpro-bold-webfont.eot?#iefix') format('embedded-opentype'),
         url('trajanpro-bold-webfont.woff') format('woff'),
         url('trajanpro-bold-webfont.ttf') format('truetype'),
         url('trajanpro-bold-webfont.svg#TrajanProBold') format('svg');
    font-weight: normal;
    font-style: normal;

}

@font-face {
    font-family: 'TrajanProRegular';
    src: url('trajanpro-regular-webfont.eot');
    src: url('trajanpro-regular-webfont.eot?#iefix') format('embedded-opentype'),
         url('trajanpro-regular-webfont.woff') format('woff'),
         url('trajanpro-regular-webfont.ttf') format('truetype'),
         url('trajanpro-regular-webfont.svg#TrajanProRegular') format('svg');
    font-weight: normal;
    font-style: normal;

}


body{
    font-family:TrajanProBold;
    background-color:#ebebeb;
    padding:0;
    margin:0;
}

and this 还有这个

<link rel="stylesheet" href="http://www.willruppelglass.com/css/slimbox2.css" type="text/css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://www.willruppelglass.com/css/styles.css" />

Any Help would be appreciated, J 任何帮助将不胜感激,J

Looking at your stylesheet ( http://www.willruppelglass.com/css/styles.css ), I can see that the TrajanProBold is being applied to only two elements: 查看样式表( http://www.willruppelglass.com/css/styles.css ),我可以看到TrajanProBold只应用于两个元素:

body and input bodyinput

However, the Slimbox stylesheet ( http://www.willruppelglass.com/css/slimbox2.css ) has another font stack applied to 但是,Slimbox样式表( http://www.willruppelglass.com/css/slimbox2.css )应用了另一个字体堆栈

#lbBottom

So, the Slimbox fonts would override the TrajanProBold font, at least on the element mentioned. 因此,Slimbox字体将覆盖TrajanProBold字体,至少在提到的元素上。

Change 更改

src: url('trajanpro-regular-webfont.eot');

to

src: url('trajanpro-regular-webfont.ttf');

check your .htaccess in root folder as well in sub directories. 检查根文件夹中的.htaccess以及子目录中的.htaccess。 Apply following code to appropriate .htaccess file. 将以下代码应用于适当的.htaccess文件。

Order deny,allow
    Deny from all
    <Files ~ ".(xml|css|jpe?g|png|gif|js|svg|woff|ttf|eot|woff2)$">
    Allow from all
    </Files>

In my experience with custom fonts you need the '' so you should try it as 'TrajanProBold'. 根据我使用自定义字体的经验,你需要''所以你应该尝试'TrajanProBold'。 Hopefully its as simple as that. 希望它就这么简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM