How can I make the code from this CodePen example work in Webflow?

Published on
September 22, 2023

To make the code from a CodePen example work in Webflow, you need to follow these steps:

  1. Create a new page in Webflow: Start by creating a new page in your Webflow project where you want to add the code. You can name it whatever you like.

  2. Open the Designer: Once the page is created, open the Designer by clicking on the "Designer" button in the top right corner of the Webflow dashboard.

  3. Drag and drop an embed element: In the Designer interface, locate the "Add" button on the left-hand sidebar. Click on it and select the "Embed" element. Drag and drop the Embed element onto your page.

  4. Get the code from CodePen: Go to the CodePen example that you want to implement. Locate the "HTML", "CSS", and "JavaScript" tabs and copy the code from each section separately.

  5. Paste the code into the Webflow embed element: Switch back to the Webflow Designer and double-click on the embed element you added. In the embed settings panel that appears on the right, find the "Code" section.

  6. Paste the HTML, CSS, and JavaScript code: In the "Code" section, paste the HTML code into the "Embed Code" field, the CSS code into the "Embed CSS" field, and the JavaScript code into the "Embed JS" field.

  7. Apply any necessary adjustments: Sometimes, CodePen examples may contain class names or IDs that conflict with the existing classes or IDs on your Webflow page. Make sure to update any conflicting class names or IDs to match your Webflow project's structure.

  8. Publish the changes: Once you have pasted the code and made any necessary adjustments, click "Save" in the top right corner of the Designer interface. Then click "Publish" to publish the changes to your live site.

By following these steps, you should be able to make the code from a CodePen example work in Webflow and have it integrated into your website seamlessly.

Additional Questions:

  • How do I add an embed element in Webflow?
  • What are the best practices for integrating code from CodePen into Webflow?
  • Can I use CodePen examples in different sections of my Webflow website?