您是否嘗試將字體系列名稱放在單引號中?以下工作對我來說很好。
@font-face {
font-family: 'cblockbold';
src: url('assets/fonts/creabbb_-webfont.eot');
src: url('assets/fonts/creabbb_-webfont.eot?#iefix') format('embedded-opentype'),
url('assets/fonts/creabbb_-webfont.woff') format('woff'),
url('assets/fonts/creabbb_-webfont.ttf') format('truetype'),
url('assets/fonts/creabbb_-webfont.svg#CreativeBlockBBBold') format('svg');
font-weight: normal;
font-style: normal;
}
要使用的字體作爲一個mixin,嘗試:
.ffbasic() {
font-family: ff-basic-gothic-web-pro-1,ff-basic-gothic-web-pro-2, AppleGothic, "helvetica neue", Arial, sans-serif;
}
然後style聲明中:
.your-class {
font-size: 14px;
.ffbasic();
}
我從來沒有在@ESS中使用@ font-face的問題。儘管如此,我正在使用PHP實現,所以我猜這是原始漏洞的一個缺陷。你可能想嘗試把「my_font」放在引號中(不知道它是否有用,但肯定不會使事情變得更糟,嘿嘿)。 – mingos
什麼是錯誤? – N3dst4
您使用的是什麼版本的less.js?在什麼環境下?當我在瀏覽器或WinLess中嘗試你的代碼時,它不會出現錯誤,並且編譯正確。 –