0

我正在尝试使用自定义字体并利用了我所知道的所有内容(包括 ?#iefix),它在除 IE8 和 IE7 之外的所有浏览器上都运行良好。我将其简化为最基本的内容,但仍然看到了问题。

这是测试的实时版本的链接

这是 HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel="stylesheet" href="styles.css">
</head>

<body>
<h1>This is a test.</h1>
</body>
</html>

CSS在这里:

@charset "utf-8";
/* CSS Document */

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

h1 {
    font-family: 'swz721kc';
    font-size: 42px;
    color: #000;
    font-weight: normal;
    margin: 30px 0 0 0;
    padding: 0;
}
4

2 回答 2

0

尝试这个:

@字体脸{

font-family: 'swz721kc';
src: url('/fonts/swz721kc.eot');
src: url('/fonts/swz721kc.eot?#iefix') format('embedded-opentype'),
     url('/fonts/swz721kc.woff') format('woff'),
     url('/fonts/swz721kc.ttf') format('truetype'),
     url('/fonts/swz721kc.svg#swz721kc') format('svg');
font-weight: normal;
font-style: normal;

}

在“字体”之前添加“/”。

于 2013-07-05T14:00:21.700 回答
0

尝试这个:

@font-face {
  font-family: 'swz721kc';
  font-style: normal;
  font-weight: 400;
  src: url(/compass-learning/test/fonts/swz721kc.eot);
  src: local('swz721kc'),
    url(/compass-learning/test/fonts/swz721kc.ttf) format('truetype');
}

这是我用来嵌入字体并让它们跨浏览器工作的格式。

于 2013-06-23T23:36:12.703 回答