字体awesome css和fonts文件夹正在项目中加载,但字体真棒图标显示为正方形

时间:2016-09-14 06:32:23

标签: html fonts font-awesome

我几乎在我工作的所有项目中都使用了fontawesome。但是这次我将图标显示为正方形。我也尝试了几乎所有在stackoverflow上列出的解决方案,似乎没有任何东西适用于我的情况。我猜有些东西阻止我显示fontawesome。这种情况不仅发生在托管案例中,也发生在本地案例中。我确认此文件正在浏览器中正确加载并具有适当的标题

我甚至从[codepen]

尝试了这个解决方案

结果是肯定的,但仍然将图标显示为正方形。可能是什么问题呢?

这是我的主要部分

<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Habitath</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="Habitath a online coach hiring website" />
<meta name="keywords" content="habitath, ecosystem, online coach website" />
<meta name="author" content="Habitath" />

<link rel="shortcut icon" href="img/favicon.png" />
<!-- Animate.css -->
<link rel="stylesheet" href="css/animate.css" />
<!-- Magnific Popup -->
<link rel="stylesheet" href="css/magnific-popup.css" />
<!-- Bootstrap  -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">
<link rel="stylesheet" href="css/main.css" />
<link rel="stylesheet" href="css/form.css" />
<link href="https://fonts.googleapis.com/css?family=Squada+One" rel="stylesheet">


</head>

2 个答案:

答案 0 :(得分:1)

你在项目中添加了字体文件(比如fontawesome-webfont.woff等)?不仅是css

答案 1 :(得分:0)

&#13;
&#13;
ul {
  margin: 0;
  padding: 0;
  }
ul li {
  list-style: none;
  float: left;
  margin-left: 5px;
  }
ul li a {
  text-decoration: none;
  padding: 8px 12px;
  color: #FFF;
  background: #545454;
  font-size: 20px;
  border-radius: 50%;
  transition: color 0.3s ease-in-out;
  -webkit-transition: color 0.3s ease-in-out;
  }
ul li a:hover {
  color: #C86565;
  }
&#13;
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Habitath</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="Habitath a online coach hiring website" />
<meta name="keywords" content="habitath, ecosystem, online coach website" />
<meta name="author" content="Habitath" />

<link rel="shortcut icon" href="img/favicon.png" />
<!-- Animate.css -->
<link rel="stylesheet" href="css/animate.css" />
<!-- Magnific Popup -->
<link rel="stylesheet" href="css/magnific-popup.css" />
<!-- Bootstrap  -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">
<link rel="stylesheet" href="css/main.css" />
<link rel="stylesheet" href="css/form.css" />
<link href="https://fonts.googleapis.com/css?family=Squada+One" rel="stylesheet">
</head>

<body>
 <ul>
   <li><a href="#"><i class="fa fa-facebook"></i></a></li>
   <li><a href="#"><i class="fa fa-twitter"></i></a></li>
   <li><a href="#"><i class="fa fa-github"></i></a></li>
   </ul>
 </body>
&#13;
&#13;
&#13;