Font Awesome icons are not working, I have included all required files
Under your reference, you have this:
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
Specifically, the href=
part.
However, under your full html is this:
<link src="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
Have you tried replacing src=
with href=
in your full html to become this?
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
Works for me: http://codepen.io/TheNathanG/pen/xbyFg
Font Awesome Icons are not working in HTML
Change fas fa-user-md
to fa fauser-md
and add it directly to button
.
Like so -
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&family=Poppins:wght@300&family=Roboto&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style.css">
<title>To do List</title>
</head>
<body>
<header>
<h1>My todo list</h1>
</header>
<form>
<input type="text" class="todo-input">
<button class="todo-button fa fa-user-md" type="submit">
</button>
<div class="select">
<select name="todos" class="filter-todo">
<option value="all">All</option>
<option value="completed">Completed</option>
<option value="uncompleted">Uncompleted</option>
</select>
</div>
</form>
<div class="todo-container">
<ul class="todo-list"></ul>
</div>
<script src="app.js"></script>
</body>
</html>
Font Awesome Icons do not display correctly across browsers
Could it be that your local version of font-awesome has some issues? Try using the CDN link instead.
Here's a helpful link to troubleshooting page on the Github repository of font awesome: Font awesome troubleshooting
EDIT:
Error in the question owner's case:
<link rel="stylesheet" href="filepath/font-awesome-4.6.3%202/css/font-awesome.min.css">
The reference to the question owner's copy of 'font-awesome.min.css' is malformed and has file path issues.
Solution:
Option 1: Make sure your reference file path is formed correctly and points to a valid copy of 'font-awesome.min.css'.
Option 2: Use a version provided by the CDN like so
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
Some FA icons are displayed in FF, Chrome and Safari, but no browser displays them all
I doubt that somebody will be as stupid as I am, but nevertheless I let you know about the mistake in my code.
Font Awesome consists of three fonts which are free to use.
- FA Brands
- FA Regular
- FA Solid
In the *.css they are called with @font-face
and inside of that they are separated by font-family: <Font Name>
.
If you look at my previous code, every font (brands, regular and solid) is called separatly with an individual @font-face
-argument. And that's where the magic happens!
Since FA Regular
and FA Solid
are both part of the family called Font Awesome 5 Free
several browsers seem to struggle with finding the correct font if there are two different fonts declared to be in the same family. The reason FA Brands was displayed properly is that its family is called Font Awesome 5 Brands
.
Long story short. Out of
@font-face {
font-family: 'Font Awesome 5 Brands';
font-style: normal;
font-weight: normal;
src: url("../fonts/fa-brands-400.eot");
src: url("../fonts/fa-brands-400.eot?#iefix") format("embedded-opentype"), url("../fonts/fa-brands-400.woff2") format("woff2"), url("../fonts/fa-brands-400.woff") format("woff"), url("../fonts/fa-brands-400.ttf") format("truetype"), url("../fonts/fa-brands-400.svg#fontawesome") format("svg"); }
@font-face {
font-family: 'Font Awesome 5 Free';
font-style: normal;
font-weight: 400;
src: url("../fonts/fa-regular-400.eot");
src: url("../fonts/fa-regular-400.eot?#iefix") format("embedded-opentype"), url("../fonts/fa-regular-400.woff2") format("woff2"), url("../fonts/fa-regular-400.woff") format("woff"), url("../fonts/fa-regular-400.ttf") format("truetype"), url("../fonts/fa-regular-400.svg#fontawesome") format("svg"); }
@font-face {
font-family: 'Font Awesome 5 Free';
font-style: normal;
font-weight: 900;
src: url("../fonts/fa-regular");
src: url("../fonts/fa-solid-900.eot?#iefix") format("embedded-opentype"), url("../fonts/fa-solid-900.woff2") format("woff2"), url("../fonts/fa-solid-900.woff") format("woff"), url("../fonts/fa-solid-900.ttf") format("truetype"), url("../fonts/fa-solid-900.svg#fontawesome") format("svg"); }
I made
@font-face {
font-family: 'Font Awesome 5 Brands';
font-style: normal;
font-weight: normal;
src: url("../fonts/fa-brands-400.eot");
src: url("../fonts/fa-brands-400.eot?#iefix") format("embedded-opentype"), url("../fonts/fa-brands-400.woff2") format("woff2"), url("../fonts/fa-brands-400.woff") format("woff"), url("../fonts/fa-brands-400.ttf") format("truetype"), url("../fonts/fa-brands-400.svg#fontawesome") format("svg"); }
@font-face {
font-family: 'Font Awesome 5 Free';
font-style: normal;
font-weight: 400, 900;
src: url("../fonts/fa-regular-400.eot");
src: url("../fonts/fa-regular-400.eot?#iefix") format("embedded-opentype"), url("../fonts/fa-regular-400.woff2") format("woff2"), url("../fonts/fa-regular-400.woff") format("woff"), url("../fonts/fa-regular-400.ttf") format("truetype"), url("../fonts/fa-regular-400.svg#fontawesome") format("svg");
src: url("../fonts/fa-solid-900.eot");
src: url("../fonts/fa-solid-900.eot?#iefix") format("embedded-opentype"), url("../fonts/fa-solid-900.woff2") format("woff2"), url("../fonts/fa-solid-900.woff") format("woff"), url("../fonts/fa-solid-900.ttf") format("truetype"), url("../fonts/fa-solid-900.svg#fontawesome") format("svg"); }
And now it works like a charm for all browsers.
Thanks to all your advice and help!
Have a good one,
Marcel
Font Awesome not working, icons showing as squares
According to the documentation (step 3), you need to modify the supplied CSS file to point to the font location on your site.
Related Topics
How to Let a Div Automatically Set It Own Width
How to Make The Body Width Equal to The Device-Width Automatically in CSS3 Media Query
What Is The Effect of Content: "\0020"; Property
How to Left Align Bootstrap 3 Dropdown Menu
CSS3 Transforms and Transitions (Webkit)
CSS 2.1 Spec: 8.3.1 Collapsing Margins: Cannot Properly Interpret Special Case: Clarification Sought
White-Space: Nowrap; and Flexbox Did Not Work in Chrome
How to Select Multiple Input Field Types with CSS
How to Apply a CSS Rule to All Descendants of an Elements
How to Move Bootstrap 3 Carousel Caption Below Images
HTML.Actionlink with a Specified HTML Id
CSS Bootstrap Overrides My Own CSS
Make Div Max-Height Equal to 'Window Height - 100Px'
How to Add Multiple Style Attributes to a React Element
Make Empty Div of One Line Height
Using CSS Modules in React How to Pass a Classname as a Prop to a Component