0

So, I've read and tried almost all the Stack Overflow answers on the first 5 pages of google, and I can't figure out what is actually going on.

Square Being Displayed

So, this is a screenshot of what my navigation bar is showing. As you can see the square on the right is actually supposed to be this icon here. When the blog link is clicked it is supposed to change to this icon here. See screenshots below for examples.

Demo Website - Before Clicking On Link

Demo Website - After Clicking On Link

For a working example of what I'm trying to accomplish you can visit this link here, which is directly off of StartBootstrap.com, which is a live demo template. Except where the demo site says "Pages" instead of "Blog" like my website. You can find the full GitHub Repo Here for the Template.

So I've copied their code, I've added Font Awesome via CDN, I've added it using their new Kit's Script tag, I've even downloaded it and included the /css/all.min.css and /webfonts folder into my site and it still isn't working.

Here's my code:

Sidebar.blade.php

<!-- Sidebar -->
<ul class="sidebar navbar-nav">
    <li class="nav-item active">
        <a class="nav-link" href="index.html">
            <i class="fas fa-fw fa-tachometer-alt"></i>
            <span>Dashboard</span>
        </a>
    </li>
    <li class="nav-item dropdown">
        <a class="nav-link dropdown-toggle" href="#" id="pagesDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
            <i class="fab fa-blogger-b"></i>
            <span>Blog</span>
        </a>
        <div class="dropdown-menu" aria-labelledby="pagesDropdown">
            {{-- <h6 class="dropdown-header">Login Screens:</h6> --}}
            <a class="dropdown-item" href="#"><i class="far fa-newspaper"></i> Posts</a>
            <a class="dropdown-item" href=""><i class="far fa-list-alt"></i> Categories</a>
            {{-- <div class="dropdown-divider"></div> --}}
        </div>
    </li>
    <li class="nav-item">
        <a class="nav-link" href="">
            <i class="fas fa-fw fa-chart-area"></i>
            <span>Stuff</span>
        </a>
    </li>
    <li class="nav-item">
        <a class="nav-link" href="tables.html">
            <i class="fas fa-fw fa-table"></i>
            <span>Tables</span>
        </a>
    </li>
</ul>

Relevant CSS for the Sidebar

.navbar-nav .form-inline .input-group {
  width: 100%;
}

.navbar-nav .nav-item.active .nav-link {
  color: #fff;
}

.navbar-nav .nav-item.dropdown .dropdown-toggle::after {
  width: 1rem;
  text-align: center;
  float: right;
  vertical-align: 0;
  border: 0;
  font-weight: 900;
  content: '\f105';
  font-family: 'Font Awesome 5 Solid' !important;
}

.navbar-nav .nav-item.dropdown.show .dropdown-toggle::after {
  content: "\f107";
}

.navbar-nav .nav-item.dropdown.no-arrow .dropdown-toggle::after {
  display: none;
}

.navbar-nav .nav-item .nav-link:focus {
  outline: none;
}

.navbar-nav .nav-item .nav-link .badge {
  position: absolute;
  margin-left: 0.75rem;
  top: 0.3rem;
  font-weight: 400;
  font-size: 0.5rem;
}

This website is being designed in Laravel. However this is actually a Laravel Package Development and not an actual Laravel Web Application. So this code is being symlinked into my actual website. Not that it should be of any difference.

So, what am I missing here?

Edit 1

Reference links I've tried:

FontAwesome icons not showing. Why?

Font Awesome not working, icons showing as squares

Font Awesome in CSS pseudo elements not showing

Font Awesome 5 on pseudo elements shows square instead of icon

Font awesome is not showing icon

https://www.hanselman.com/blog/WhyDoMyFontAwesomeIconsShowUpAsBlankSquares.aspx

Edit 2

I think this is not a duplicate question, as the answers for all the other questions have suggested to do some of the following which I have done.

  1. Change the font-family to "Font Awesome 5 Free", "Font Awesome 5 Solid", etc.
  2. Chance the font-weight to 900, bold, 400, etc.
  3. Include Font Awesome via CDN, direct download via the "Hosting Font-Awesome Yourself" page, etc.
  4. Tried changing the pseudo from after to before.

So while this is a "duplicate question", none of the answers from all the same question or type of question work for my specific case.

I'm also adding a link to my full package repo as it sits right now, and the Laravel web application repo as well.

Edit 3

The admin.css file is now correct in the GitHub repo, and the relevant code starts at line 10626.

halfer
  • 19,824
  • 17
  • 99
  • 186
J. Robinson
  • 931
  • 4
  • 17
  • 45
  • 1
    It's hard to debug your code, but have you tried using `font-family: "Font Awesome 5 Free"`? – Chris Happy Oct 23 '19 at 03:53
  • did you really try all the link you share? one of them contain the solution: https://stackoverflow.com/q/50681748/8620333 – Temani Afif Oct 23 '19 at 10:02
  • @ChrisHappy Yes I have tried. – J. Robinson Oct 23 '19 at 19:53
  • @TemaniAfif Yes I have tried that solution. – J. Robinson Oct 23 '19 at 19:53
  • your actual code is showing an invalid font-family – Temani Afif Oct 23 '19 at 20:01
  • I've posted the GitHub repos in an edit. Feel free to take a look around. I'm also changing it to "Font Awesome 5 Free" right now, and it still gives me the same issue. – J. Robinson Oct 23 '19 at 20:05
  • @TemaniAfif please get rid of the Duplicate, as I've edited the question to include why this isn't a duplicate. None of the answers on any of the other questions have worked for me. – J. Robinson Oct 23 '19 at 20:14
  • *None of the answers on any of the other questions have worked for me* --> you need to show us this. If i take the portion of your code related to the icon and I correct the font family it works fine: https://jsfiddle.net/2Ltzfjpu/ so this is still a duplicate. – Temani Afif Oct 23 '19 at 20:18
  • @TemaniAfif After looking at your JSFiddle, I saw you were correct. It is working. For some reason, the `all.min.css` file that is included in the font-awesome download page is apparently not the correct version. Apparently that version is the 5.0.7 version. I've since updated the all.min.css file to the content inside of the CDN file you linked in your JSFiddle and it works. So I guess this issue is chalked down to the wrong version being downloaded and used? It's still kind of weird that the "Host Font Awesome Yourself" download link is giving an older version of the css file. – J. Robinson Oct 23 '19 at 21:05

4 Answers4

3

(Posted on behalf of the question author, to move it from the question to the answer section).

Problem has been solved. This whole issue was due to using an outdated version of Font-Awesome. So for anyone who is running across this issue, please make sure that you are using the most current version of Font-Awesome!

halfer
  • 19,824
  • 17
  • 99
  • 186
0

Categories and Tables are fixed by using fa fa-list-alt and fa fa-fw fa-table.

Nguyễn Văn Phong
  • 13,506
  • 17
  • 39
  • 56
ROBIN
  • 1
-1

you need to use "Font Awesome 5 Free" as font-family (if you're using the free version)

https://fontawesome.com/how-to-use/on-the-web/advanced/css-pseudo-elements

-2

Did you try to give the specific element a font-weight: bold; ?

In case of a fas a font-weight bold fixed it sometimes.

Erik-Jan
  • 194
  • 8