Integrate Google Maps map responsively


Owner & Managing Director of ithelps Digital. Since 2013, he has been deeply engaged in SEO and online marketing.
With Google Maps, Google offers the ingenious option of integrating a location map into your own website. Unfortunately, a normally integrated Google Maps map is not adapted to the size of the end device. I'll show you how it still works.
Integrate a responsive Google Maps map in 2 steps
To integrate a Google Maps map responsively on a website so that it automatically adapts to the screen sizes of different end devices, only a few simple steps are actually necessary. This adaptation is particularly important as more and more users are accessing websites on mobile devices such as smartphones and tablets. A map that does not adapt can significantly impact the user experience.
Step-by-step guide
1. Embedding the iFrame code in a div container
Firstly, you need to embed the iFrame code provided by Google Maps in an additional div container. The iFrame code is an HTML element that allows you to embed an external website - in this case Google Maps - into your own website. By embedding it in a div container, you gain control over the display of the map through CSS.
An example of this could look like this
<div class="responsive_map"> <!-- This is where the iFrame code from Google Maps comes in --></div>
You replace the comment with the actual iFrame code that you receive from Google Maps.

Dein Ansprechpartner:
Florian Prohaska - Co-Founder
Möchtest du mehr Kunden über das Internet gewinnen? Wir können helfen!
- SEO: Sichtbarkeit und qualifizierten Traffic durch gezielte SEO-Strategien
- Google Ads: Effektive Werbekampagnen für maximalen ROI.
- Webdesign: Professionelles Design, das deine Besucher beeindruckt.
- Webshops: Individuelle Lösungen für erfolgreiche Online-Shops.
- Content-Erstellung: Wertvolle Inhalte, die Interessenten überzeugen.
2. Adding CSS for the responsive functionality
The next step is to add CSS code to make the map responsive. This means that the map changes its size to fit into the container element, which in turn adapts to the size of the browser window or device display.
The necessary CSS code looks like this:
.responsive_map { position: relative; overflow: hidden; padding-bottom: 56.25%; /* 16:9 Aspect Ratio */ height: 0; }.responsive_map iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
This code causes the div container(responsive_map
) to maintain a ratio of 16:9, which is a good choice for most use cases as it corresponds to the usual aspect ratio of videos. The iFrame is scaled so that it fills the entire container. You can change the aspect ratio by adjusting padding-bottom
. For example, padding-bottom: 75%
would create a 4:3 ratio.
Advantages of this method
- Ease of use: Your website will look better and be easier to use on all devices.
- Flexibility: You can easily change the aspect ratio of the map to suit your design needs.
- Simplicity: This method only requires simple HTML and CSS, without the need for JavaScript or other libraries.
These steps will ensure that your Google Maps map looks and works well on all devices. This method of responsive embedding is not just limited to Google Maps, but can also be used for other iFrame-based content, making it a valuable tool for web developers.
Any questions?
If you have any further questions on the topic or would like professional support, feel free to get in touch with us. Send an email to office@ithelps-digital.com, call us at +43 1 353 2 353, or reach out for us on our contact page.