【发布时间】:2019-12-27 22:33:56
【问题描述】:
我在从本地加载字体时遇到问题,我正在指向目录。有人可以帮我吗?
这是我的代码
@font-face {
font-family: 'My font';
src: url('./fonts/Myfonts-webfont.eot');
src: url('./fonts/Myfonts-webfont.eot?#iefix') format('embedded-opentype'),
url('./fonts/Myfonts-webfont.woff') format('woff'),
url('./fonts/Myfonts-webfont.ttf') format('truetype'),
url('./fonts/Myfonts-webfont.svg#my_fonts_otbook') format('svg');
font-weight: normal;
font-style: normal;
}
and using it as
.btn {
font-family: 'My font', sans-serif;
max-width: 100%;
width: 20%;
height: 8%;
}
【问题讨论】:
-
你遇到了什么错误?
-
我在加载我的应用程序时没有收到任何错误,加载的是无衬线字体而不是我的字体。
-
当我构建我的应用程序时,我收到了来自 webpack 的性能警告
-
资产:font/myfonts-Book.ttf (315 KiB) font/myfonts-Semibold.ttf (257 KiB) 供应商~main.aa2cd040f0c1fba7504e.bundle.js (1.52 MiB) 入口点大小限制:The以下入口点的组合资产大小超过了建议的限制 (244 KiB)。这会影响网络性能。
标签: javascript css reactjs fonts storybook