简体   繁体   中英

CSS - renaming fonts

A fellow programmer has built a page with webfonts, but didn't provide any fallbacks in the font-family rules for where they added this to the appropriate html elements.

for example:

#someDiv { font-family: "my font"; }

In some special cases, we're not loading the webfont, and it looks pretty ugly. The font should fall back on Arial. Instead of going over the CSS line-by-line and fix this, is there a way to add a font-face rule or something similar so that "my font" will show Arial?

Found the answer:

@font-face {
    font-family: "my font";
    src: local("Arial");
}

将您的后备添加到当前的字体系列链中。

#someDiv { font-family: "my font", Arial, sans-serif; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM