CSS 中怎样加载外部字体文件路径在 CSS 中,我们可以使用 `@font-face` 规则来加载外部字体文件。该规则是一个可以引入 Unicode 字符字体的集合的指令。为了使用该规则,我们需要在
@font-face { font-family: 'Roboto'; src: url('/fonts/roboto/Roboto-Regular.ttf') format('truetype'); } body { font-family: 'Roboto', sans-serif; }
@font-face { font-family: 'Roboto'; src: url('/fonts/roboto/Roboto-Regular.ttf') format('truetype'), url('/fonts/roboto/Roboto-Regular.woff') format('woff'), url('/fonts/roboto/Roboto-Regular.woff2') format('woff2'); }
粉丝
0
关注
0
收藏
0