我无法在弹出窗口中添加Font Awesome图标,请帮我解决问题。我不知道如何在CSS中添加图标并更改颜色。
以下是HTML代码:
<i class="fas fa-check-circle">
这是CSS:
.fa-check-circle {color: #ffffff;}
出了什么问题? 它不能工作。我在弹出窗口中看不到图标。 这是我的网址
我无法在弹出窗口中添加Font Awesome图标,请帮我解决问题。我不知道如何在CSS中添加图标并更改颜色。
以下是HTML代码:
<i class="fas fa-check-circle">
这是CSS:
.fa-check-circle {color: #ffffff;}
出了什么问题? 它不能工作。我在弹出窗口中看不到图标。 这是我的网址
没有添加Fontawesome库。请添加。
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
替换这个 -
<i class="fas fa-check-circle">
带有
<i class="fa fa-check-circle">
<link rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.5.0/css/all.css"
integrity="sha384-
B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU"
crossorigin="anonymous">
另一种使用fontawesome图标的方法是下载他们的整个图标库,其中包含他们的脚本和类,并将它们直接链接到您的页面上。
<?xml
encoding='UTF-8'
version='1.0' ?>
<!DOCTYPE html>
<!--[if lt IE 7 ]>
<html class="no-js ie6">
<![endif]-->
<!--[if IE 7 ]>
<html class="no-js ie7">
<![endif]-->
<!--[if IE 8 ]>
<html class="no-js ie8">
<![endif]-->
<!--[if (gte IE 9)|!(IE)]>
<!-->
<html
xmlns:og='http://opengraphprotocol.org/schema/'
class='js'
lang='id'>
<!--<![endif]-->
<head prefix='og: http://ogp.me/ns#'>
<script>
//<![CDATA[ /* SundaGeeks MainJs - Version 26.1 */
// ███████╗██╗ ██╗███╗ ██╗██████╗ █████╗ ██████╗ ███████╗███████╗██╗ ██╗███████╗
// ██╔════╝██║ ██║████╗ ██║██╔══██╗██╔══██╗ ██╔════╝ ██╔════╝██╔════╝██║ ██╔╝██╔════╝
// ███████╗██║ ██║██╔██╗ ██║██║ ██║███████║ ██║ ███╗█████╗ █████╗ █████╔╝ ███████╗
// ╚════██║██║ ██║██║╚██╗██║██║ ██║██╔══██║ ██║ ██║██╔══╝ ██╔══╝ ██╔═██╗ ╚════██║
// ███████║╚██████╔╝██║ ╚████║██████╔╝██║ ██║ ╚██████╔╝███████╗███████╗██║ ██╗███████║
// ╚══════╝ ╚═════╝ ╚═╝ ╚═══╝╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝╚══════╝
const Title = document.createElement(
`title`
);
const TextTitle = `
SundaGeeks ツ is a white hat hacker security web developer indonesian professional inter/local ≪ SundaGeeks :: IndoXploit
`;
const MetaHttpEquiv = document.createElement(
`meta`
);
const MetaViewport = document.createElement(
`meta`
);
const ViewportSettings = `
height=device-height,
width=device-width,
minimum-scale=1.0,
initial-scale=1.0,
maximum-scale=1.0,
user-scalable=no
`;
const ErudaTools = document.createElement(
`script`
);
const SourceErudaTools = `
https://cdnjs.cloudflare.com/ajax/libs/eruda/3.0.1/eruda.js
`;
const Icons = document.createElement(
`script`
);
const SourceIcons = `
https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/js/all.min.js
`;
const IntegrityIcons = `
sha512-uKQ39gEGiyUJl4AI6L+ekBdGKpGw4xJ55+xyJG7YFlJokPNYegn9KwQ3P8A7aFQAUtUsAQHep+d/lrGqrbPIDQ==
`;
const CustomIcons = document.createElement(
`link`
);
const SourceCustomIcons = `
https://pro.fontawesome.com/releases/v5.10.0/css/all.css
`;
const IntegrityCustomIcons = `
sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p
`;
const Style = document.createElement(
`style`
);
const Css = `
html,
body,
*,
*::before,
*::after{
-webkit-touch-callout:none !important;
-webkit-user-select:none !important;
-moz-user-select:none !important;
-ms-user-select:none !important;
user-select:none !important}
html{
-webkit-scroll-behavior:smooth !important;
-moz-scroll-behavior:smooth !important;
-ms-scroll-behavior:smooth !important;
scroll-behavior:smooth !important;
-webkit-text-size-adjust:none !important;
-moz-text-size-adjust:none !important;
-ms-text-size-adjust:none !important;
text-size-adjust:none !important;
-webkit-touch-action:manipulation !important;
-moz-touch-action:manipulation !important;
-ms-touch-action:manipulation !important;
touch-action:manipulation !important}
body{
-webkit-overscroll-behavior:contain !important;
-moz-overscroll-behavior:contain !important;
-ms-overscroll-behavior:contain !important;
overscroll-behavior:contain !important;
height:100vh;
width:100vw;
padding:0;
margin:0}
*,
*::before,
*::after{
box-sizing:border-box;
padding:0;
margin:0}
.fad{
border-radius:10%;
background-color:#222;
justify-content:center;
align-items:center;
display:inline-flex;
padding:2%;
--fa-primary-color:#3378ff;
--fa-secondary-color:#999;
}
`;
MetaHttpEquiv.setAttribute(
`http-equiv`,
`Content-Type`
);
MetaHttpEquiv.setAttribute(
`content`,
`text/html;charset=utf-8`
);
MetaViewport.setAttribute(
`name`,
`viewport`
);
MetaViewport.setAttribute(
`content`,
ViewportSettings
);
ErudaTools.setAttribute(
`src`,
SourceErudaTools
);
Icons.setAttribute(
`src`,
SourceIcons
);
Icons.setAttribute(
`integrity`,
IntegrityIcons
);
Icons.setAttribute(
`crossorigin`,
`anonymous`
);
Icons.setAttribute(
`referrerpolicy`,
`no-referrer`
);
CustomIcons.setAttribute(
`href`,
SourceCustomIcons
);
CustomIcons.setAttribute(
`integrity`,
IntegrityCustomIcons
);
CustomIcons.setAttribute(
`crossorigin`,
`anonymous`
);
CustomIcons.setAttribute(
`rel`,
`stylesheet`
);
Style.textContent = Css;
document.getElementsByTagName(
`head`
)[0].appendChild(
Title
);
document.getElementsByTagName(
`head`
)[0].appendChild(
MetaHttpEquiv
);
document.getElementsByTagName(
`head`
)[0].appendChild(
MetaViewport
);
document.getElementsByTagName(
`head`
)[0].appendChild(
ErudaTools
);
document.getElementsByTagName(
`head`
)[0].appendChild(
Icons
);
document.getElementsByTagName(
`head`
)[0].appendChild(
CustomIcons
);
document.getElementsByTagName(
`head`
)[0].appendChild(
Style
);
window.addEventListener(
`load`,
(event)=>{
eruda.init({
tool: [
`resources`,
`elements`,
`console`,
`network`,
`info`
]
});
eruda.get().config.set(
`displaySize`,
60
);
eruda.remove(
`settings`
);
Title.textContent = TextTitle;
}
);
//]]>
</script>
<style>
</style>
</head>
<body style="display:flex;justify-content:center;align-items:center">
<center>
<h3 style="margin-bottom:20px">
<em>
Answered Question <i class="fab fa-stack-overflow fa-2xl"></i>
</em>
</h3>
<div style="gap:10px;width:140%;margin-left:-20%;">
<i class="fad fa-terminal fa-2xs"></i>
<i class="fad fa-terminal fa-xs"></i>
<i class="fad fa-terminal fa-sm"></i>
<i class="fad fa-terminal"></i>
<i class="fad fa-terminal fa-lg"></i>
<i class="fad fa-terminal fa-xl"></i>
<i class="fad fa-terminal fa-2xl"></i>
</div>
<p style="margin-top:20px"> Design: <strong>SundaGeeks</strong></p>
<p style="margin-top:20px"> Powered: FontAwesome </p>
</center>
</body>
</html>
使用以下代码更改CSS:
.fas {
color: red;
}
从您的代码中并不清楚是否已经将 Font Awesome 包含在您的页面中。请在您的页面中添加此行代码(在 <head> 标签之间)。
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
fas
类可以判断 OP 正在使用版本 5。 - Smollet777