Generate responsive Google Maps embed code automatically using custom HTML and CSS code, easily and instantly for free!
Embedding a map from Google Maps on your webpage is a great way to make your content more visually appealing. It also provides more details regarding a location of something you are writing about. Google Maps is a great service to provide accurate data of geolocation that turns it into a digital map on which you can interact with.
By default, Google Maps' iframe code is not responsive as it contains fixed width and height. But with simple HTML and CSS tweaks, you can embed it responsively across all devices. That's the main function of this Responsive Google Maps Embed Generator tool.
Embed Google Maps in your web sites is as simple as two steps. Search for the location or area you want to embed on Google Maps, then click the hamburger icon in the top left corner and select the Share or embed map option from the menu. Standard maps, satellite maps, and even street views can be included.
The maps will resize to fit the screen of the device and load only when the user scrolls to the map, making the website load faster.
First of all, you can embed Google Maps responsively and freely without having to use API key. You only need simple HTML and CSS tweaks for this.
Just follow these simple steps:
The example of generated HTML code would be like this:
<div class="google-maps">
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d15776.068885428647!2d115.16540895!3d-8.689911500000001!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x2dd246dfe07cc8ff%3A0x5030bfbca82fdd0!2sSeminyak%2C%20Kuta%2C%20Badung%20Regency%2C%20Bali%2C%20Indonesia!5e0!3m2!1sen!2suk!4v1661542952274!5m2!1sen!2suk" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
</div>
Now add the following CSS code to make the magic happen:
.google-maps {
position: relative;
padding-bottom: 75%;
height: 0;
overflow: hidden;
}
.google-maps iframe {
position: absolute;
top: 0;
left: 0;
width: 100% !important;
height: 100% !important;
}
The 75% can be adjusted as you need.
Test it and see that you now have a responsive Google Maps embedded on your webpage.
Other interesting tools related to this one. More tools are coming soon!