In Webflow, where do I need to put the HTML, CSS, and JS code from the Jsfiddle to make it work on my website?

Published on
September 22, 2023

To make a JSFiddle code work on your website in Webflow, you'll need to follow these steps:

  1. Add an HTML Embed element: In Webflow, you can add an HTML Embed element to any page or template by dragging and dropping it from the sidebar. This element allows you to inject custom HTML code onto your page.

  2. Copy your HTML code: In JSFiddle, locate the HTML code section of your fiddle and copy the entire code.

  3. Paste the HTML code: In the HTML Embed element in Webflow, paste the copied HTML code. Webflow will automatically render this code onto your page.

  4. Add CSS code: If your JSFiddle code includes CSS styling, you'll need to add it to your Webflow project. There are a few different ways to add CSS in Webflow:

  • Inline Styles: If your CSS code is minimal, you can add it as inline styles directly in the HTML Embed element. Simply include the <style> tags along with your CSS code.

  • <style> tag in the <head> section: If you have a significant amount of CSS code or want to keep it separate from your HTML, you can add a <style> tag to the <head> section of your page template. To do this, go to the Project Settings, choose the Custom Code tab, and add your <style> tag within the Head Code section.

  • External CSS file: Alternatively, you can create an external CSS file and link it to your page template. To do this, create a new CSS file in your Webflow project, add your CSS code there, and then include a <link> tag in the <head> section to link to this external file.

  1. Include JS code: Similarly to CSS, if your JSFiddle code includes JavaScript, you'll need to add it to your Webflow project. You can add JS code in the following ways:
  • Inline Scripts: If your JavaScript code is minimal, you can add it as an inline script directly in the HTML Embed element. Include the <script> tags along with your JS code.

  • <script> tag at the bottom of the <body> section: For more extensive JavaScript code or if you prefer to keep it separate from your HTML, add a <script> tag at the bottom of the <body> section of your page template. Go to the Project Settings, choose the Custom Code tab, and add your <script> tag within the Footer Code section.

  • External JS file: You can also create an external JS file, add your JavaScript code there, and then include a <script> tag at the bottom of the <body> section to link to this external file.

  1. Save and preview your changes: Once you have added the necessary HTML, CSS, and JS code to your Webflow project, save your changes and preview your website to ensure that the JSFiddle code functions as expected.

By following these steps, you can incorporate code from JSFiddle into your Webflow website and make it work seamlessly.

Additional questions:

  1. How do I add custom HTML code in Webflow?
  2. What are the different ways to include CSS in Webflow?
  3. How can I add JavaScript to my Webflow project?