0
fontFaceString = "@font-face {font-family: 'Lobster';font-style: normal;font-weight: normal;src:url('../../fonts/new_fonts/LOBSTER/Lobster-regular.ttf');}";
var newStyle = document.createElement('style');
newStyle.appendChild(document.createTextNode(fontFaceString));
document.head.appendChild(newStyle);
我必須動態添加多個字體。我只是想添加一個字體與上面的代碼片段,它被添加到樣式標記但不正確渲染。動態添加的字體工作不正常
提供一個例子jsfiddle或您的實際頁面 – dev