Webflow sync, pageviews & more.
NEW

How can I make my iframe embed responsive in Webflow?

TL;DR
  • Drag an Embed element into a Div block set to 100% width and relative position, with top padding (e.g., 56.25%) to preserve aspect ratio.
  • Style the iframe with absolute positioning, top/left 0, and width/height 100% to make it scale responsively within the wrapper.

To make an iframe embed responsive in Webflow, you need to ensure it scales correctly across screen sizes while maintaining its aspect ratio.

1. Use the Embed Element in Webflow

  • Drag the Embed element into your Webflow project from the Add panel (under Components).
  • Paste your iframe code into the Embed box.

2. Wrap the iFrame in a Responsive Div

  • Place the Embed element inside a Div block. This wrapper will control the aspect ratio and scaling.
  • Set the wrapper’s position to “relative” and width to 100%.
  • Add a top padding to the wrapper to preserve aspect ratio (e.g., 56.25% for 16:9).

3. Style the iFrame for Responsiveness

  • In the Embed code, add styling to the iframe tag:
  • Set position: absolute
  • Set top: 0; left: 0
  • Set width: 100%; height: 100%

This makes the iframe fill its relatively positioned wrapper, and the top padding creates the correct aspect ratio.

4. Use Webflow’s Video or Embed Best Practices

  • For YouTube or Vimeo videos, consider using Webflow’s built-in Video element, which is responsive by default.
  • For third-party iframes (e.g., maps), follow the wrapper method above.

Summary

Wrap the iframe inside a Div block with 100% width and padding-top for aspect ratio, then set the iframe itself to absolute position with width/height at 100%. This ensures your embedded content remains responsive across devices.

Rate this answer

Other Webflow Questions