在使用@fontace
时,是否可以使用绝对路径?我的文件目录结构如下:
-HP
|--font
| |- Monoton.woff
| |- Monoton.eot
|--css
| |- font.css
| |- fontface.css
|--html
|-index.html
定义了字体
@font-face {
font-familiy: Monoton;
src: url('../font/Monoton.woff') format('woff'); // EDIT: Change fonts to font the name of th woff-file
font-weight: normal;
font-style: normal;
}
并将其用作 CSS 类 monoton:
@import url('fontFace.css');
.monoton {
font-familiy: Monoton, cursive;
font-size: 1.875em;
color: rgba(0, 200, 0, 1);
}
但是在Chrome、Firefox和其他浏览器中不起作用,有人能解释一下原因吗?我已经将fontFace.css
和所有字体文件放在HTML目录中了。现在它可以正常工作了。