通过其他一些关于类似问题的线索,但他们的解决方案没有奏效。我已经成功地使用下面的代码来添加一个字体到我们的网站,这是基于一个全面的引导模板。我现在开始在一个新站点上工作,这次只使用基本引导模板,并尝试通过相同的方法添加字体。@ font-face chrome中的未被捕获的语法错误
@font-face {
font-family: 'myfontname';
src: url('font/myfontname-Regular.svg');
src: url('font/myfontname-Regular.eot');
src: url('font/myfontname-Regular.eot?#iefix') format('embedded-opentype'),
url('font/myfontname-Regular.woff2') format('woff2'),
url('font/myfontname-Regular.woff') format('woff'),
url('font/myfontname-Regular.ttf') format('truetype')
}
@font-face {
font-family: 'myfontname';
font-weight: bold;
src: url('font/myfontname-Bold.svg');
src: url('font/myfontname-Bold.eot');
src: url('font/myfontname-Bold.eot?#iefix') format('embedded-opentype'),
url('font/myfontname-Bold.woff2') format('woff2'),
url('font/myfontname-Bold.woff') format('woff'),
url('font/myfontname-Bold.ttf') format('truetype')
}
.myfontnameBOLD{
font-family: myfontname;
font-weight: bold;
text-transform: uppercase;
}
.myfontnameREG{
font-family: myfontname;
}
文件的存储方式与之前的一样(我的css文件夹内的Font文件夹)。然而,这一次,我碰到下面的错误
uncaught syntaxError:Invalid or unexpected token
在Chrome中调试突出的地方说:“@字体面” 我跑这通过短绒并没有什么问题的第一行,但即使IE是给一个错误并突出显示@ font-face并说它有一个缺少的分号。 任何人都能看到可能是错的?谢谢
在此之前的css是什么 - 在导致此线被拾取为错误之前,代码中可能会出现错误(例如,未关闭括号或类似内容) – Pete
没有css之前,此是它包含的唯一CSS。谢谢 –
之前包含的其他样式表呢? – Pete