[英]Is there a way to use the same base64 data URI with two @font-face declarations?
I have a CSS file with @font-face declarations. 我有一个带有@ font-face声明的CSS文件。 The corresponding fonts are stored as base64-encoded WOFFs within the declarations.
相应的字体在声明中存储为base64编码的WOFF。 For reasons that you'll have to trust are good ones, I'd like to create multiple @font-face declarations that point at the same base64 WOFF (meaning, without duplicating it within the CSS file, nor moving it to an external file.)
出于您必须信任的好理由的原因,我想创建多个@ font-face声明,这些声明指向相同的base64 WOFF(这意味着无需在CSS文件中复制它,也无需将其移动到外部文件中) )
Can it be done? 能做到吗 If so, how?
如果是这样,怎么办?
进一步的研究提出了一个简单的答案:不可能做到。
Pure CSS do not have pointers. 纯CSS没有指针。
Have a look at SASS or LESS, which are pre-compilers for CSS. 看看SASS或LESS,它们是CSS的预编译器。
They allow (among of other things) the use of variables: 它们允许(除其他事项外)使用变量:
@b64woff: url("data:font/opentype;base64,AAEAAAATAQAABAAwR1BPU7iiypwABG5IAA...");
@font-face {
font-family: 'YourFont';
src: @b64woff;
}
In fact, when LESS or SASS will compile your code, it will replace every instance of @b64woff
with its value. 实际上,当LESS或SASS编译您的代码时,它将用其值替换
@b64woff
每个实例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.