How can I keep the fontawesome icon displayed if I remove certain tags in the HTML source code when using Webflow?

Published on
September 22, 2023

To keep the FontAwesome icon displayed even if you remove certain tags in the HTML source code when using Webflow, you can follow these steps:

  1. Identify the tag that is containing the FontAwesome icon. It is typically an <i> or <span> tag with the class fa or fas, followed by the specific icon class (e.g., fa-search).

  2. In your Webflow project, go to the page where you want to remove certain tags but keep the icon displayed.

  3. Locate the element or component that contains the tag you want to remove while preserving the icon.

  4. Click on the element to select it and open the settings panel on the right.

  5. In the settings panel, navigate to the "Custom Attributes" section.

  6. Add a new custom attribute by clicking on the "+" button. Name the attribute as "data-ignore" (you can use any name you prefer).

  7. In the value field of the new custom attribute, enter the name of the tag you want to remove. For example, if you want to remove <span> tags, enter "span" as the value.

  8. Save the changes.

  9. Publish or update your Webflow site.

By following these steps, the tags you specified in the custom attribute will be removed when the page loads, but the fontawesome icons will still be visible.

In essence, we're using a custom attribute to instruct Webflow to ignore specific tags during rendering, allowing the icon classes to remain unchanged.

This technique can be especially useful when you need to remove unnecessary tags for structural or styling purposes without impacting the visibility of certain elements like FontAwesome icons.

Example:

Suppose you have the following HTML code containing a FontAwesome icon inside a <span> tag:

<span class="fa fa-search"></span>

If you want to remove the <span> tag while keeping the icon displayed, you would follow the steps mentioned above and add the custom attribute as:

data-ignore="span"

Additional Questions:

  1. How can I add FontAwesome icons to my Webflow project?
  2. Can I customize the appearance of FontAwesome icons in Webflow?
  3. What other ways can I optimize and enhance the typography on my Webflow site?