Skip to content
English
  • There are no suggestions because the search field is empty.

How to Add SVG Icons to a webflow project?

The use improves the performance of a website by laoding faster than fonts or images. To achieve that we need to convert our svg files to code, then paste it to webflow and adjust it to be responsive and easy to change color.

Video Tutorials

Part 1:

https://www.loom.com/share/26a7d856403d442a9dd686d59e23387d?sid=28e60448-d088-4ecc-bb49-ddccfabeb2a7

Part 2:

https://www.loom.com/share/e29602c3a0b7430aa50d6c962b85dfc3?sid=77501f72-41da-470e-ace1-8e1d8693ffbb

Part 3:

https://www.loom.com/share/1efd743b86ef47678ef9185fef3f2c13?sid=1177e3db-bc11-4a65-9888-705d8cd564d4

 

Step 1: Go to the Style Page

  1. On your webflow project go to the Utilities Pages Folder > Style Guide Page 
  2. Scroll down to the Icons Section.
  3. Once you are there duplicate any of the icons already created.

 

Step 2: Generate the code

For this process you need to have created the icon on illustrator or figma,  and save it as an svg.

  1. Go to https://editsvgcode.com/
  2. Upload your svg file
  3. Copy the code generated there.
  4. Go back to the webflow project.

 

Step 3: Paste the code on the HTML Embed

Go back to the webflow project and select the icon you duplicated on the step 1. 

  1. Make sure the icon has the Icon HTML Embed class
  2. On the right panel go Element Settings and click on the Open the Code Editor option
  3. Scroll down after the code of the other icon and paste the code from editsvgcode.com

 

Step 3: Remove any unnecessary code and add necessary attributes

The SVG tag should look like this:

 <svg  class="svg-icon" enable-background="new 0 0 512.004 512.004;" xmlns="http://www.w3.org/2000/svg"  viewBox="0 0 512.004 512.004"  style="width: 100%;">  

The viewbox and the enable-background should be the same as the new generated code. This are the details of what you you need to remove:

  1. If the code has any xml version: <?xml version="1.0" encoding="iso-8859-1"?> please delete it.
  2. Look for the svg tag <svg if it has any id="" please delete it.
  3. Make sure that the only  class="" that the <svg has is class="svg-icon"
  4. Important: Make sure that the  has the same coordinates are the ones of the generated code: enable-background="new 0 0 512.004 512.004;"
  5. xmlns="http://www.w3.org/2000/svg" stays the same.
  6. Make sure that the style tag looks like this  style="width: 100%;" remove any other styles that it may have.
  7. Keep the   viewbox="" attribute exactly as it is on the new code.  
  8. Remove any <g> or </g> tag that you may find. (sometimes there isn’t)

Step 4: Add the fill attribute to the path tag

  1. Inside the <path> tag add the following attribute fill="currentColor" before the closing >, this attribute will allow to change the color of the icon. 
  2. Some icons have multiple <path> tags, you need to add the fill="currentColor" to each <path>.
  3. Click save and close to check if the Icon looks good
  4. If it does, you need to delete the previous icon code.

Step 5: Modify the Style of an Icon

  1. To modify the style of the Icon you need to paste it inside a <div></div>, there are clases like “Large Icon” or “Small Icon”, but you can also create a new one. 
  2. Make sure to always modify the Parent div and never change the HTML embed and the Icon HTML Embed class
  3. To change the color you need to change the text color of the parent div.
  4. To change the size you need to change the width of the parent div.

Step 6: Questions or Doubts

If you have any questions or doubts, please contact Sofia Muñoz in Slack.