Interactive map embeds often don't scale properly on smaller screens because they are either fixed-width or lack responsive sizing. Here’s how you can fix this in Webflow.
1. Use a Responsive Embed Element
- Instead of using a raw HTML embed, use Webflow’s Embed element from the Add panel.
- Wrap the embed inside a div block and give that div a percentage width (e.g., 100%) and a relative position.
- Add an aspect-ratio style to that wrapper div (e.g., 16:9 using padding-bottom method or with CSS
aspect-ratio
property if supported).
2. Apply Flexibility to Width and Height
- In the Embed code, remove any hardcoded
width
and height
attributes. - Instead, use CSS styles like
width: 100%
and height: 100%
within a parent container that defines the aspect ratio.
3. Set a Specific Aspect Ratio for Mobile
- For mobile and tablet breakpoints, make sure the wrapper maintains a usable size:
- Use a padding-bottom trick (e.g., 56.25% for 16:9) on the wrapper div to maintain aspect ratio.
- On Webflow, you can do this by setting a padding-bottom on a relative-positioned div, and the embedded map inside gets absolute positioning with full width and height.
4. Adjust Styles for Breakpoints
- Use Webflow's breakpoint controls to ensure that on Tablet, Mobile Landscape, and Mobile Portrait, the wrapper and iframe adjust correctly.
- Verify this using the Preview mode in each breakpoint.
5. Double-Check Embed Code
- If embedding a Google Map, ensure the iframe includes flexible parameters, or modify existing ones:
- Remove
style="border:0;" width="600" height="450"
from iframe. - Replace with styles controlled in Webflow’s Designer panel.
Summary
To fix map embeds not scaling on mobile, wrap your iframe inside a div with a defined aspect ratio and use percentage-based widths and height via CSS. Remove any hard-coded pixel sizes in the embed and verify scaling in all breakpoints using Webflow Designer.