我正在覆盖一个@font-facecss 声明:
/* ORIGINAL */
@font-face {
font-family: 'Font1';
src: url('/PATH1/font1.eot');
...
}
/* MY OVERRIDE */
@font-face {
font-family: 'Font1';
src: url('/PATH2/font1.eot');
...
}
Run Code Online (Sandbox Code Playgroud)
我注意到浏览器尝试同时使用路径'/PATH2/font1.eot'和'/PATH1/font1.eot'. 有没有办法避免两个取之一,只留下一个?
谢谢
@font-face 规则定义外部字体:
<style id="customfont">
@font-face {
font-family: a_font;
src: url(https://fonts.gstatic.com/s/quicksand/v22/6xK-dSZaM9iE8KbpRA_LJ3z8mH9BOJvgkP8o58a-wg.woff2);
}
body {
font-family: a_font !important;
}
</style>
<p>Some text. The quick brown fox jumped over the lazy dog... but it didn't make it up all the way.</p>Run Code Online (Sandbox Code Playgroud)
要更改它,请修改innerHTML元素的属性。
以下是修改元素的 HTML 代码的方法:
+--------------+------------------------------+
| innerHTML | HTML within the tags |
+--------------+------------------------------+
| outerHTML | HTML, with the tags |
+--------------+------------------------------+
| appendChild | add an element to the end |
+--------------+------------------------------+
| prepend | prepend element |
+--------------+------------------------------+
Run Code Online (Sandbox Code Playgroud)
此示例使用innerHTML:
+--------------+------------------------------+
| innerHTML | HTML within the tags |
+--------------+------------------------------+
| outerHTML | HTML, with the tags |
+--------------+------------------------------+
| appendChild | add an element to the end |
+--------------+------------------------------+
| prepend | prepend element |
+--------------+------------------------------+
Run Code Online (Sandbox Code Playgroud)
这应该更改字体 src。