【发布时间】:2021-10-07 18:24:55
【问题描述】:
我们如何在 CSS 中使用 Font Awesome Icon?我想在标题后显示一个图标。 我想稍微自定义一下我的标题,这样标题后面就会有一个图标。
这是我的代码
<!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">
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css"
integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous" />
<title>Test</title>
<style>
* {
margin: 0;
padding: 0%;
box-sizing: border-box;
}
.main-div {
width: 100vw;
height: 100vh;
padding-top: 100px;
text-align: center;
}
h1 {
color: #2980b9;
font-size: 5rem;
}
h1::after {
font-family: "Font Awesome 5 Free";
font-weight: 900;
content: "\f007";
width: 20vh;
height: 25px;
color: #1abc9c;
font-size: 3rem;
display: inline-block;
margin: 0 auto;
}
</style>
</head>
<body>
<section class="main-div">
<h1>Test</h1>
</section>
</body>
</html>
但是,图标没有出现。另外,如何使用 css 显示该图标?
任何帮助将不胜感激!
【问题讨论】:
-
该样式表不包含
Font Awesome 5 free的声明
标签: html css bootstrap-4 font-awesome-5