我有以下代码。它在所有四种情况下都能正确显示。但是,当复制div(右键单击/复制)并粘贴到Word文档中时,四个div的字体依次为:Times
,Trebuchet
,Courier
,{ {1}}。
仅使用内联样式集识别字体。知道为什么Trebuchet
字体被css
忽略了吗?更重要的是,我可以在我的CSS中修复此问题,还是在每种情况下都使用内联代码明确设置字体?
有趣的是,copy
的默认值为<pre>
,但Courier
的默认值为<div>
(我的浏览器和MS Word的默认值均为Times
)。如果<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 :(得分:0)
字体Trebuchet,Courier是否在您的系统字体中。 点击此处:控制面板&gt;字体 在MS-Word
中复制/粘贴时,只有此文件夹中存在的字体才能自行维护