2014-08-29 75 views
0

我有以下代码。它在所有四种情况下都能正确显示。但是,当div复制(右键单击/复制)并粘贴到Word文档中时,四个div的字体顺序为:TimesTrebuchet,Courier,Trebuchet复制/粘贴忽略CSS字体

字体只能用内联样式集识别。任何想法为什么css字体被忽略copy?更重要的是,我可以在我的CSS中解决这个问题,还是我在每种情况下都使用内联代码显式设置字体?

这也是有趣的是,为<pre>默认为Courier但对于<div>Times(都为我的浏览器和MS Word缺省设置)。如果<pre>没有给我Courier,我几乎可以接受输出。

<style> 
pre {font-family:"trebuchet ms",arial,sans-serif;} 

.test {font-family:"trebuchet ms",arial,sans-serif;} 
</style> 

<div class="test"> 
Test of div with css set font 
</div> 

<div class="test" style="font-family:'trebuchet ms',arial,sans-serif"> 
Test of div with inline font 
</div> 


<div> 
<pre> 
Test of pre with css set font 
</pre> 
</div> 

<div> 
<pre style="font-family:'trebuchet ms', arial, sans-serif"> 
Test of pre with inline font 
</pre> 
</div> 

回答

0

字体Trebuchet,Courier是否在您的系统字体中。 检查这里:控制面板>字体 只有在MS-Word中复制/粘贴时,此文件夹中的字体才能自行保留。

+0

当使用内嵌css指定字体时,它们显示出来。问题不在于缺少字体。 – mseifert 2014-08-29 23:01:14