外部css中有多个font-face

时间:2012-07-18 17:09:35

标签: html css font-face

我知道可以在css上使用multiple font-faces。 现在我有两个使用这些字体的html页面,但将来会有更多;现在这些font-faces通过内联css声明并通过类使用。我真正想要的是将我所有的font-faces包装成一个fonts.css,然后在每个单独的html页面上引用css并使用<p class="...-font"><p>

所以我的字体'css是这样的:

@font-face {
        font-family: 'Komika';
        src: url('/bin/res/font/KOMIKAX_-webfont.eot');
        src: url('/bin/res/font/KOMIKAX_-webfont.eot?#iefix') format('embedded-opentype'),
        url('/bin/res/font/KOMIKAX_-webfont.woff') format('woff'),
        url('/bin/res/font/KOMIKAX_-webfont.ttf') format('truetype'),
        url('/bin/res/font/KOMIKAX_-webfont.svg#KomikaAxisRegular') format('svg');
        font-weight: normal;
        font-style: normal;
}
.komika-font {font: 30px 'Komika', Tahoma, sans-serif;}

@font-face {
        font-family: 'Nevis';
        src: url('/bin/res/font/nevis-webfont.eot');
        src: url('/bin/res/font/nevis-webfont.eot?#iefix') format('embedded-opentype'),
        url('/bin/res/font/nevis-webfont.woff') format('woff'),
        url('/bin/res/font/nevis-webfont.ttf') format('truetype');
        font-weight: normal;
        font-style: normal;
}
.nevis-font {font: 500% 'Nevis', Tahoma, sans-serif;}

html就像这样:

<head>
<link rel="stylesheet" href="/bin/res/style-fonts.css.php" type="text/css" />
<link rel="stylesheet" href="/bin/res/style.css.php" type="text/css" />
<title><?php echo $photo_title ?></title>
</head>

<body>
    <h1 class="____">Some text here</h1>
<body>

在____应该是“nevis-font”,但IDE(Dreamweaver)甚至不会自动完成。

有可能吗?因为我尝试了它并且它不起作用(所选字体没有显示)。


我想我明白了,问题是包含font-faces的css不能像我一样以.php结尾。我只使用* .css.php,因为.php强制服务器压缩css文件。

2 个答案:

答案 0 :(得分:1)

是的,这是可能的。为了回答更详细的答案,我们需要您解决以前遇到的问题的更多细节。

答案 1 :(得分:0)

问题是包含font-faces的css不能像我一样以.php结尾。我只使用* .css.php,因为.php强制服务器压缩css文件。

相关问题