字体真棒图标未显示,仅显示框

发布于 2025-01-12 06:20:32 字数 633 浏览 0 评论 0原文

我尝试使用 font Awesome 中的图标,但它不起作用,我复制了脚本链接并将其粘贴到 head 标签,但它只显示一个框。

注意:我添加了实际的套件编号,只是将其隐藏在这里。您可以检查图像。 屏幕截图

<head>
  <title>Page Title</title>
  <script src="https://kit.fontawesome.com/my-kit-number.js" crossorigin="anonymous">
    .
  </script>
</head>

<body>
  <i class="fa-solid fa-microphone"></i>
  <h1>My First Heading</h1>
  <p>My first paragraph.</p>
</body>

I tried to use an icon from font awesome but it’s not working, i copied the script link and pasted it to the head tag but it’s just showing a box.

Note: I added the actual kit number, I’m just hiding it here. You can check the image.
Screenshot

<head>
  <title>Page Title</title>
  <script src="https://kit.fontawesome.com/my-kit-number.js" crossorigin="anonymous">
    .
  </script>
</head>

<body>
  <i class="fa-solid fa-microphone"></i>
  <h1>My First Heading</h1>
  <p>My first paragraph.</p>
</body>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

固执像三岁 2025-01-19 06:20:32

工作示例图像

对“my-kit-number”的引用是错误的,您需要转到此处: https://fontawesome.com/start 并添加电子邮件,以便您可以收到有效的脚本源替换'my-kit-number' 为有效 ID

working example image

the reference to 'my-kit-number' is wrong you need to go here: https://fontawesome.com/start and add an email so then you can receive a valid script source replacing 'my-kit-number' for a valid id

趁年轻赶紧闹 2025-01-19 06:20:32

必须使用 .fa.fas。无需工具包,此示例使用免费 CDN。

<!DOCTYPE html>
<html lang="en">

<head>
  <title></title>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
  <style>
     :root {
      font: 2ch/1 Consolas
    }
  </style>
</head>

<body>
  <p><i class="fas fa-microphone"></i> class="fas fa-microphone"</p>
  <p><i class="fa fa-microphone"></i> class="fa fa-microphone"</p>
</body>

</html>

The either .fa or .fas must be used. No need for a kit this example is using a free CDN.

<!DOCTYPE html>
<html lang="en">

<head>
  <title></title>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
  <style>
     :root {
      font: 2ch/1 Consolas
    }
  </style>
</head>

<body>
  <p><i class="fas fa-microphone"></i> class="fas fa-microphone"</p>
  <p><i class="fa fa-microphone"></i> class="fa fa-microphone"</p>
</body>

</html>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文