Embedding Google Maps
Google Maps provides iframe embed code via the Share dialog. Paste the iframe directly into your HTML to display an interactive map.
Make the map responsive by wrapping it in an aspect-ratio container.
Google Maps provides iframe embed code via the Share dialog. Paste the iframe directly into your HTML to display an interactive map.
Make the map responsive by wrapping it in an aspect-ratio container.
<!-- Wrapper for responsive map -->
<div style="position: relative; width: 100%; aspect-ratio: 16/9;">
<iframe
src="https://www.google.com/maps/embed?pb=..."
width="100%"
height="100%"
style="border:0;"
allowfullscreen=""
loading="lazy"
referrerpolicy="no-referrer-when-downgrade"
title="Location map"
></iframe>
</div>
Use aspect-ratio: 16/9 on the wrapper instead of the old padding-bottom hack for responsive iframes.