此代碼在我的單個HTML頁面上正常工作,HTML文件和字體都位於同一文件夾中。@ font-face在本地工作,而在使用url時不工作
@font-face {
font-family: myFont;
src: url(DroidKufi-Regular.ttf);
}
現在我試圖在網站中添加字體並使用代碼中的鏈接。
src: url("http://hnauae.com/myFonts/DroidKufi-Regular.ttf");
這一個不工作,任何人都可以解釋我爲什麼?
什麼是您收到的控制檯錯誤添加? – Roberrrt
嘗試使用相對路徑而不是絕對路徑。 – claudios
你在網站上使用https嗎?如果你使用https,那麼'src'也需要是https,以防止CORS錯誤 –