css 字体图标没有显示

vmpqdwk3  于 11个月前  发布在  其他
关注(0)|答案(3)|浏览(98)

我有Inter字体。我从Google Fonts得到它。但它不能显示。似乎箭头看不到字体。你可以看到它。

而不是Google Inter Font页面上的相同箭头



css:

<head>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">
<style>

   body{
     font-family: 'Inter', sans-serif;
   }

</style>
</head>

字符串
html:

<div> ↗</div>
<div >Almost before we knew it, we had left the ground. ↗</div>


怎么了?

insrf1ej

insrf1ej1#

https://fonts.googleapis.com/css2上使用CSS API使用的字体比完整TTF提供的字体稍轻。
可能的解决办法:
1.您可以使用text=参数,以包含文档中详细说明的所有您关心的字符

<link href="https://fonts.googleapis.com/css2?family=Inter&text=Almost%20befrwkni,hadgu.↗" rel="stylesheet">

<div style="font-family: Inter, sans-serif;">
  Almost before we knew it, we had left the ground. ↗
</div>

字符串

  • 您可以为家庭下载整个TTF并将其与您的网站一起自行托管。
  • 优化跨浏览器的字体,为每个浏览器提供最佳格式(woff,woff2,svg,ttf等)
  • 将字体划分为常用的Unicode部分,以避免在网站仅使用拉丁字符时加载大的有效载荷(整个字体)
  • 字体可能发生的更新,以修复易读性等问题
h43kikqp

h43kikqp2#

如果你想使用自定义字体,你应该将这些字体复制到你项目文件夹中,然后使用CSS代码将它们添加到你的文档中

@font-face {
  font-family: Inter;
  src: url(sansation_light.woff);
}

字符串
将此src替换为您在项目中复制的字体地址

gcxthw6b

gcxthw6b3#

就用这个代码:它对我有用

<!DOCTYPE html>
<html>
<head>

<link href="https://fonts.googleapis.com/css2?family=Inter" rel="stylesheet">
<style>
body{
     font-family: Inter, sans-serif;
   }
p {
  font-family: verdana;
  font-size: 20px;
}
div{
font-family: Inter;
    font-weight: 400;
    font-style: normal;
    font-size:x-large;
    }
</style>
</head>
<body>
<div> ↗</div>
<div >Almost before we knew it, we had left the ground. ↗</div>


</body>
</html>

字符串

相关问题