To embed a CodePen into your Webflow site, you'll need to extract the embed code from CodePen and insert it into an Embed element in Webflow.
1. Copy the Embed Code from CodePen
- Open the CodePen you want to embed.
- Click the “Embed” button below the Pen or in the top-right navigation bar.
- Choose your embed style (default, dark style, etc.).
- Click “Copy Embed Code.”
- The embed code usually includes a
<iframe>
tag, or a script if you're embedding a live preview.
2. Add an Embed Component in Webflow
- In Webflow Designer, drag an “Embed” element from the Add panel (under Components) into the desired section or container.
- In the Embed settings, paste the CodePen embed code directly into the code editor.
- Click “Save & Close.”
3. Publish Your Site to See the Embed
- Webflow’s Designer does not render external embeds like CodePen in the preview.
- Click “Publish” to your staging domain to test the live embed.
- Go to your published site URL and confirm the CodePen is loading properly.
4. Optional: Adjust Embed Size or Responsiveness
- If the embed code uses fixed width/height values, replace them with responsive CSS styles using Webflow classes or inline CSS (
width: 100%; height: auto;
). - Alternatively, you can wrap the Embed element inside a responsive div block and style it for different screen sizes.
Summary
To add a CodePen to Webflow, simply copy the CodePen embed code and paste it into a Webflow Embed element. Then publish your site to test it live.