Font Awesome 5 icons not showing up

Mr. ED picture Mr. ED · Feb 23, 2018 · Viewed 23.9k times · Source

I use codeigniter and Font Awesome 5 I have download the latest version of font awesome 5 how ever for some reason my icon is not showing up

Question How to get the icon to show up in font awesome 5 I am using xampp

It should show next to the sign in text there are no errors in dev console

enter image description here

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title><?php echo $title;?></title>
    <link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/plugins/bs/css/bootstrap.css');?>">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/css/stylesheet.css');?>">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/plugins/fa/web-fonts-with-css/fontawesome-all.min.css');?>">
    <script type="text/javascript" src="<?php echo base_url('assets/js/jquery-3.2.1.slim.min.js');?>"></script>
    <script type="text/javascript" src="<?php echo base_url('assets/js/popper.min.js');?>"></script>
    <script type="text/javascript" src="<?php echo base_url('assets/plugins/bs/js/bootstrap.js');?>"></script>
</head>
<body>

<div class="row mb-3">
    <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-xs-12">
        <a href="<?php echo base_url('login');?>" class="btn btn-dark"><i class="fas fa-sign-in-alt"></i> Sign in</a>
    </div>
</div>

</body>
</html>

Answer

mikeym picture mikeym · Apr 12, 2018

The instructions on the font awesome site for getting 5.0.10 running are a little confusing when it comes to what files should go where. I ran into this exact problem and solved it with these steps:

  1. Create the following directory

    /static/styles/fontawesome/css

  2. Copy and paste all fontawesome css files into the above directory

  3. Copy the entire webfonts directory and paste in into /static/styles/fontawesome (so that it is at same level as the css directory)

  4. Add the following to your html header <link rel="stylesheet" href="static/styles/fontawesome/css/fontawesome-all.css">

  5. Add icon tags to your code using the corresponding version documentation (5.0.10)
    <i class="fas fa-tachometer-alt"></i>

Note: Be sure to use only icons from the free set if you do not have a pro licence. https://fontawesome.com/icons?d=gallery&m=free

This might not work for everyone but hope it helps someone out with this frustrating problem!