我正在尝试在排除某些标签的同时设置一些 html 的样式。例如,下面我有一个 html,它为 2 段不同字体的文本设置样式:
<span style="font-family: Tahoma, Arial, sans-serif">Test 1</span>
<span style="font-family: Verdana, Arial, Helvetica, sans-serif">Test 2</span>
<span style="font-family: Arial, Helvetica, sans-serif">Test 3</span>
我想将不是 Arial 字体的跨度样式覆盖为 Times New Roman,并且我尝试了以下 css:
span {
font-family: "Times New Roman" !important;
font-weight: normal !important;
font-size: 12pt !important;
font-size-adjust: none !important;
font-stretch: normal !important;
font-variant: normal !important;
font-style: normal !important;
background-color: white !important;
}
以上也改变了 Arial 文本的样式,我想排除正在设置样式的 Arial 文本。
注意css是用来对多个源html进行样式化的,而源html的样式中可以有更多的标签,定义了文本的大小、粗细等,所以样式标签的内容是不可预测的。
如何告诉 css 排除样式为 Arial 字体的标签。
我还在 Microsoft Word 中打开 html 以打印 html,因此这也需要使用 Word 工作。