无法使用 font-awesome 在 html 代码中加载主页图标
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>WEbsite</title>
<link rel="stylesheet" href="css/style.css" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.0/css/all.min.css"
/>
</head>
<body>
<header class="header">
<nav class="nav-bar">
<a href="#home"><i class="fa-regular fa-house"></i> <span>home</span></a>
</nav>
</header>
</body>
</html>
无法使用 font-awesome 在 html 代码中加载主页图标。浏览器显示十字图标,代替主页图标。请告诉我代码有什么问题?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>WEbsite</title>
<link rel="stylesheet" href="css/style.css" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.0/css/all.min.css"
/>
</head>
<body>
<header class="header">
<nav class="nav-bar">
<a href="#home"><i class="fa-regular fa-house"></i> <span>home</span></a>
</nav>
</header>
</body>
</html>
Unable to load home icon in html code using font-awesome. In place of home icon, browser showing a cross icon. Kindly, tell me what's wrong with the code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 fa-solid 代替常规。
Use
fa-solid
instead of regular.Fontawesome 图标加载正常,但您使用了错误的类。
代替
到
The Fontawesome icon is loaded fine, but you're using the wrong classes.
Replace
<i class="fa-regular fa-house"></i>
to
<i class="fa fa-house"></i>