所以看起来,如果我分配一个以数字结尾的字体系列,它不会粘住
a = document.createElement("div")
a.style.fontFamily = "Arial"
然后a是
<div style="font-family: Arial; "></div>
但是
a = document.createElement("div")
a.style.fontFamily = "Goudy Bookletter 1911"
然后a是
<div></div>
我很确定是尾数问题。由于
a = document.createElement("div")
a.style.fontFamily = "Goudy Bookletter blablabla"
然后a是
<div style="font-family: 'Goudy Bookletter blablabla'; "></div>
这是一个错误吗?我在 chrome 16 中这样做
最佳答案
设置字体系列时,空格和数字会导致问题。将字体系列名称用单引号括起来可以让它在 Chrome 16 中工作。
a.style.fontFamily = "'Goudy Bookletter 12'";
没有引号我看到了以下奇怪的行为
a.style.fontFamily = "Goudy Bookletter12"; //works
a.style.fontFamily = "Goudy 12Bookletter"; //works
a.style.fontFamily = "Goudy 12 Bookletter"; //does not work
关于javascript - 分配以数字结尾的 CSS 字体系列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8951584/