Home > Web Front-end > CSS Tutorial > Font Awesome 5 JS SVG Showing Empty Squares: How Do I Fix It?

Font Awesome 5 JS SVG Showing Empty Squares: How Do I Fix It?

Barbara Streisand
Release: 2024-12-26 12:21:13
Original
507 people have browsed it

Font Awesome 5 JS SVG Showing Empty Squares: How Do I Fix It?

Font Awesome 5 Displays Empty Square with the JS SVG Version

When attempting to use the JS SVG version of Font Awesome 5 to replace list item bullet points with icons, an empty square may appear instead of the intended icon. To resolve this, enable the use of pseudo-elements in the JS version by adding the data-search-pseudo-elements attribute to the script tag.

<script data-search-pseudo-elements src="https://use.fontawesome.com/releases/v5.13.0/js/all.js"></script>
Copy after login

To customize the icon appearance, target the SVG element using CSS:

.testitems svg {
  color: blue;
  margin: 0 5px 0 -15px;
}
Copy after login

For clarity, this solution is for the JS SVG version of Font Awesome 5. If you encounter this issue with the CSS version, refer to "Font Awesome 5, why css content is not showing?".

The above is the detailed content of Font Awesome 5 JS SVG Showing Empty Squares: How Do I Fix It?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template