How can I hide the text after the font awesome icon using CSS without having to put it in a span.
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css">
<li class="nav-item">
<a class="nav-link" href="opt-categories.php">
<i class="fa fa-truck"></i>
Food Categories
</a>
</li>
2
Answers
Set the font size for entire link text to 0:
then revert that property, for the icon only:
Other option would be to make text just invisible e.g.
color: transparent;
for the link andcolor: black;
for the icon only.visibility: hidden
seems to work well