角度 4 中的动态字体文件 URL 中的问题



我的字体文件路径保存在数据库中,当站点加载时,从数据库加载@font面网址。 代码如下

@font-face { 
font-family: 'Robototext'; 
src: url('http://10.0.0.189:4000/1078/Webshop/Font/ARIALBD_1533892648708.TTF') format('ttf'); 
font-style: normal; 
font-weight: 500;
}

并在 Html 页面中加载该字体系列名称,如下所示

<body style="font-family: 'robototext';">
<div class="wrapper clearfix" id="wrapper">
</div>
</body>

但它对我不起作用 以我的风格.css

body {
Font-family: 'Roboto', sans-serif
}

在检查元素中看到时,它超过了权限,但实际的"ARIALBD_1533892648708.TTF"没有加载。

你能帮我解决什么问题吗,请帮助我解决这个问题

在你的@font-face中,你设置了font-family: 'Robototext';但在你的 css 中,你使用的是Font-family: 'Roboto', sans-serifRobotoRobototext不同。

在您的 css 文件中尝试此操作。

font-family: "Robototext", sans-serif;

最新更新