我必须从文件夹中将字体加载到 css 中,但它不起作用
html
是:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style>
@font-face { font-family: 'HelveticaWorld'; font-style: normal; font-weight: bold; src: URL("../Fonts/HelveticaWorld-Bold.ttf") format('ttf'); }
</style>
</head>
<body>
<div style="margin-bottom: 15px; font-weight: bold;font-family: HelveticaWorld"">Setup</div>
</body>
</html>
最佳答案
查看zip文件,你的字体路径和格式是错误的。尝试:
@font-face { font-family: 'HelveticaWorld'; font-style: normal; font-weight: bold; src: URL("font/HelveticaWorld-Bold.ttf") format('truetype'); }
关于html - css 无法以正确的方式加载字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14689937/