Home > Web Front-end > CSS Tutorial > Why Are Font Awesome 5 SVG List Item Bullets Showing as Empty Squares?

Why Are Font Awesome 5 SVG List Item Bullets Showing as Empty Squares?

DDD
Release: 2024-12-16 03:31:09
Original
747 people have browsed it

Why Are Font Awesome 5 SVG List Item Bullets Showing as Empty Squares?

Font Awesome 5 Shows Empty Square when Using the JS SVG Version

When attempting to use Font Awesome 5 with the JS SVG version, users may encounter an issue where list item bullets are rendered as empty squares. This problem arises from the fact that Font Awesome 5 disables pseudo-element support by default.

Solution

To enable pseudo-element support for the JS version of Font Awesome 5, add 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

Additionally, it's crucial to style the SVG elements within the pseudo-elements:

.testitems:before {
  content: "\f058";
  display: none;
}

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

By following these steps, users can seamlessly integrate Font Awesome 5 with pseudo-elements in their JavaScript applications.

The above is the detailed content of Why Are Font Awesome 5 SVG List Item Bullets Showing as Empty Squares?. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template