Font awesome icons 4 and 5 are displaying accurately

When utilizing Font Awesome, I am able to display 4 out of 5 icons correctly. However, the last icon (stackoverflow icon) does not appear:

Here is the HTML code:

<ul>
  <li><a href="#"><i class="xcon-facebook"></i></a></li>
  <li><a href="#"><i class="xcon-twitter"></i></a></li>
  <li><a href="#"><i class="xcon-linkedin"></i></a></li>
  <li><a href="#"><i class="xcon-instagram"></i></a></li>
  <li><a href="#"><i class="xcon-stackoverflow"></i></a></li>
</ul>

Also, here is the CSS code:

.xcon-facebook:before { content: '\f09a'; } /* '' */
.xcon-twitter:before { content: '\f099'; }  /* '' */ 
.xcon-linkedin:before { content: '\f0e1'; }  /* '' */
.xcon-instagram:before { content: '\f16d'; }  /* '' */
.xcon-stackoverflow:before { content: '\f16c'; }  /* '' */

To see how they look visually, click here.

I attempted to resolve the issue by modifying this line as follows:

.xcon-stackoverflow:before { content: '\f16c'; font-family: 'Font Awesome 5 Free';} /* '' */ 

However, there was no change in the outcome.

Answer №1

stack-overflow is classified under "Brands icons", requiring the correct font-family to be included:

.icon::before {
  display: inline-block;
  font-style: normal;
  font-variant: normal;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
}

.foo::before {
  /* won't work */
  font-family: "Font Awesome 5 Free"; content: "\f16c";
}

.bar::before {
  /* works */
  font-family: "Font Awesome 5 Brands"; content: "\f16c";
}
<link href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" rel="stylesheet"/>
<nav>
  <ul>
    <li><span class="icon foo"></span></li>
    <li><span class="icon bar"></span></li>
  </ul>
</nav>

Answer №2

Incorporate Brands instead of Free

To align them in a single line (as shown in the image), apply display:flex;

.xcon-facebook:before { content: '\f09a'; font-family: 'Font Awesome 5 Brands'; }
.xcon-twitter:before { content: '\f099'; font-family: 'Font Awesome 5 Brands'; } 
.xcon-linkedin:before { content: '\f0e1';  font-family: 'Font Awesome 5 Brands'; }
.xcon-instagram:before { content: '\f16d'; font-family: 'Font Awesome 5 Brands'; } 
.xcon-stackoverflow:before { content: '\f16c'; font-family: 'Font Awesome 5 Brands'; } 
ul{
display:flex;
 list-style: none;
}
li{
padding:5px;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">
<ul>
  <li><a href="#"><i class="xcon-facebook"></i></a></li>
  <li><a href="#"><i class="xcon-twitter"></i></a></li>
  <li><a href="#"><i class="xcon-linkedin"></i></a></li>
  <li><a href="#"><i class="xcon-instagram"></i></a></li>
  <li><a href="#"><i class="xcon-stackoverflow"></i></a></li>
</ul>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Populate the table with JSON object information

I've structured a table as follows: <div class="row"> <div class="row"> <table class="table table-bordered table-striped tree-grid"> <thead class="text-primary"> <tr> <th> ...

Displaying then concealing a Bootstrap alert - unable to display again

I'm working with a basic hidden dismissible bootstrap alert: <div id="selectedAssets" class="alert alert-info text-center alert-dismissible" role="alert" style="display:none"> <button type="button" class="close" data-dismiss="alert" a ...

What could be causing the submission failure of the form post validation?

My Code: <form method="post" name="contact" id="frmContact" action="smail.php"> ... <label for="security" class="smallPercPadTop">Please enter the result:</label> <br /><h3 id="fNum" class="spnSecurity"></h3>& ...

The Bootsrap 5.3 navbar is not fully extending to the width of the page

My goal is to have the list items in a Bootstrap navbar stretch across the width of the page in mobile view, but I'm having trouble achieving this. I've tried following various tutorials without success. I even attempted using *{margin:0;padding ...

The final child is refusing to eliminate the bottom border

HTML: <div class="offer-section"> <div class="divider"></div> </div> <div class="offer-section"> <div class="divider"></div> </div> <div class="offer-section"> <div class="divider">&l ...

Incorporating a View into a Sidebar in CakePHP

I'm currently facing some challenges understanding the concepts of CakePHP's views, blocks, and layouts. My goal is to have a left and right sidebar displayed on every page, with content that may vary. Right now, I have the right sidebar set up ...

Displaying HTML widget in an external browser using R

Is there a way to directly display an HTML widget (such as one created by dygraphs) in an external browser like Chrome? Saving the widget, creating an HTML page, linking it to the widget, and using browseURL could be an option, but I am looking for a more ...

How to position an image on top of each printed page using HTML/CSS (SCSS)

I've created a simple and small webpage that looks like this: https://i.sstatic.net/R7Ajz.png Everything is perfect in the browser, with all the styles (margin, padding, etc.) just as I want it. However, my issue lies in the print view of the page. ...

Having trouble with Bootstrap 4: I want to rotate an image, but every time I try, it ends up overwriting the CSS properties

I am currently working on a website using bootstrap 4, and I'm facing an issue with the image I selected. It seems to rotate to the right and is not displaying correctly. click here for image preview The main problem lies in rotating the image witho ...

Relocate the Bootstrap selector box form to align with the left side of the page

I have included the Bootstrap CDN in my project, and I am encountering an issue with a form that contains a dropdown box. The problem is that the legend tag is properly aligned to the left of the page, but the selector box is slightly indented towards th ...

Saving an HTML5 canvas image to an MSSQL varbinary(max) field: A step-by-step guide

SAVING CANVAS IMAGE AS BASE64 STRING TO HIDDEN FIELD This script binds the base64 string to a hidden field on click event. save.addEventListener('click', function (event) { var dataUrl = canvas.toDataURL(); $('txtbx').val(dataUrl) ...

`Some Items Missing from Responsive Navigation Menu`

Hey there! I'm currently diving into the world of responsive design and I'm attempting to create a navigation bar that transforms into a menu when viewed on a mobile device or phone. Everything seems to be working fine, except that not all the na ...

Ways to exit the current browser window?

Is there a way to close the current browser window using JavaScript or another language that supports this functionality? I've tried using the window.close() function, but it seems to only work for windows opened with window.open(). Thank you in adv ...

"Bringing in a Nunjucks Macro - How to Easily Use It

I've been working on a script that renders a nunjucks contact.html template with the following code: let fs = require('fs'); let nj = require('nunjucks'); var contact = fs.readFileSync('./src/contact.html',&a ...

Using loops in Sass mixins causes errors

I have been developing a SASS code to generate CSS output that has the following format. background: -webkit-linear-gradient(top, 50%); background: -moz-linear-gradient(top, 50%); background: linear-gradient(top, 50%); This is the SASS mixin code I cr ...

Transitioning the height of a Vue component when switching routes

I've been struggling to implement a transition slide effect on my hero section. The height of the hero is set to 100vh on the homepage and half of that on other pages. Despite trying various methods, I haven't been able to get it working properly ...

Ensure that the view remains consistent while navigating a table that contains expanding concealed information

My table is dynamically populated with data within a div that has overflow: scroll and height set properties. The issue I face is that the data populates from the top, making it difficult to keep track of specific rows when scrolling within the #container ...

Is there a way to prevent the imported JQuery from causing issues with current code implementations?

Being a novice developer in Html/Javascript/CSS/Jquery coding, I recently encountered an issue while integrating Jquery into my project. When I imported Jquery, the styling of simple buttons went haywire. Jquery worked perfectly fine when using its classes ...

How can I retrieve the current background color and revert it back after a .hover event?

I am trying to use the .hover function to change the background color of a menu. Each menu item has a different background color, so I want it to return to its original color when the user hovers off. In other words, I want the script to read the current b ...

When tapping on grid items in the Safari browser using React Material-UI, they mysteriously switch positions

I've encountered an issue with grid Items in my React MATERIAL-UI project, specifically in the Safari browser. The problem does not occur in Chrome or Firefox. Within the grid, there are checkboxes that move from one place to another when clicked, a ...