Home >Web Front-end >CSS Tutorial >Why Are My Font Awesome 5 Pseudo-Elements Showing Squares Instead of Icons?
Why Font Awesome 5 Pseudo Elements Display Squares Instead of Icons
When attempting to modify the content of a span using Font Awesome icons via CSS, you may encounter instances where square placeholders appear instead of the intended icons. This issue arises specifically with pseudo elements.
To resolve this, follow these steps:
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.x.y/css/all.css">
.myClass::after { font-family: 'Font Awesome 5 Free'; content: "\f008"; font-weight: 900; }
Additional Considerations:
This issue only occurs with certain Unicode code points (e.g., f007 may work while f008 does not).
If you prefer to load Font Awesome using the JS SVG method, refer to the documentation for specific alternative steps.
The above is the detailed content of Why Are My Font Awesome 5 Pseudo-Elements Showing Squares Instead of Icons?. For more information, please follow other related articles on the PHP Chinese website!