0

我知道在 css 上可以有多个字体。现在我有两个使用这些字体的 html 页面,但将来会有更多;现在这些字体是通过内联 css 声明并通过类使用的。我真正想要的是将我所有的字体包装成一个 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) 甚至不会自动完成。

是否可以?因为我试过了,它没有用(选择的字体没有显示)。


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

4

2 回答 2

1

是的,这是可能的。我们需要有关您曾经遇到的问题的更多详细信息,以便回答更详细的答案。

于 2012-07-18T17:11:25.317 回答
0

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

于 2012-07-18T17:44:47.227 回答