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.